diff options
author | Joey Hess <joey@kitenet.net> | 2014-02-25 14:09:39 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-02-25 14:48:50 -0400 |
commit | f55d91cc91eec2debf4bb013ff2f5201ea1474ea (patch) | |
tree | 8b8701608fef4f49622018f26706ebd46bfae943 /Command/Fsck.hs | |
parent | c3aaa702c8fe4424dacfddfc255fca8d6149ad06 (diff) |
fix all remaining -Wall warnings on Windows
Diffstat (limited to 'Command/Fsck.hs')
-rw-r--r-- | Command/Fsck.hs | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/Command/Fsck.hs b/Command/Fsck.hs index 6cf444967..a30e895d0 100644 --- a/Command/Fsck.hs +++ b/Command/Fsck.hs @@ -466,7 +466,8 @@ getFsckTime key = do - To guard against time stamp damange (for example, if an annex directory - is copied without -a), the fsckstate file contains a time that should - be identical to its modification time. - - (This is not possible to do on Windows.) + - (This is not possible to do on Windows, and so the timestamp in + - the file will only be equal or greater than the modification time.) -} recordStartTime :: Annex () recordStartTime = do @@ -477,10 +478,10 @@ recordStartTime = do withFile f WriteMode $ \h -> do #ifndef mingw32_HOST_OS t <- modificationTime <$> getFileStatus f - hPutStr h $ showTime $ realToFrac t #else - noop + t <- getPOSIXTime #endif + hPutStr h $ showTime $ realToFrac t where showTime :: POSIXTime -> String showTime = show @@ -494,15 +495,18 @@ getStartTime = do f <- fromRepo gitAnnexFsckState liftIO $ catchDefaultIO Nothing $ do timestamp <- modificationTime <$> getFileStatus f -#ifndef mingw32_HOST_OS - t <- readishTime <$> readFile f - return $ if Just (realToFrac timestamp) == t + let fromstatus = Just (realToFrac timestamp) + fromfile <- readishTime <$> readFile f + return $ if matchingtimestamp fromfile fromstatus then Just timestamp else Nothing -#else - return $ Just timestamp -#endif where readishTime :: String -> Maybe POSIXTime readishTime s = utcTimeToPOSIXSeconds <$> parseTime defaultTimeLocale "%s%Qs" s + matchingtimestamp fromfile fromstatus = +#ifndef mingw32_HOST_OS + fromfile == fromstatus +#else + fromfile >= fromstatus +#endif |