Re: [GHC] #7473: getModificationTime gives only second-level resolution

#7473: getModificationTime gives only second-level resolution ----------------------------------------+---------------------------------- Reporter: duncan | Owner: Type: bug | Status: new Priority: normal | Milestone: 7.8.1 Component: libraries/directory | Version: 7.6.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: ----------------------------------------+---------------------------------- Comment (by redneb): I cannot reproduce that. In my experiments, `GetFileAttributesEx` works as expected. To test this I ran the following command (in a cygwin shell so that I can use sleep): {{{ #!sh echo 1 >> test.txt && ./modtime test.txt && sleep 0.1 && echo 2 >> test.txt && ./modtime test.txt }}} The output was: {{{ test.txt: 2013-08-29 00:30:02.4667839 UTC test.txt: 2013-08-29 00:30:02.5869567 UTC }}} As you can see that's full 100ns resolution. And here's the code for the modtime program I used above: {{{ #!haskell import System.Win32 import Data.Time () import Data.Time.Clock.POSIX import System.Environment main :: IO () main = getArgs >>= mapM_ printModTime printModTime :: String -> IO () printModTime path = do fad <- getFileAttributesExStandard path let FILETIME ft = fadLastWriteTime fad mt = posixSecondsToUTCTime (fromIntegral (ft - win32_epoch_adjust) / 10000000) putStrLn (path ++ ": " ++ show mt) win32_epoch_adjust :: DDWORD win32_epoch_adjust = 116444736000000000 }}} This requires my patches [1] for win32 to compile. [1] https://github.com/haskell/win32/pull/10 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/7473#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC