Windows: Fix handling of changes to time zone.

Used to work but was broken in version 7.20181031, specifically commit
5ab0f48ffb.

That this was not noticed over at least 1 daylight savings time zone
changes makes me wonder if the TSDelta stuff is still needed.
Perhaps the mtime on Windows no longer changes when the time zone is changed?

(cherry picked from commit 09ee6b0ccb)
This commit is contained in:
Joey Hess 2019-11-06 14:36:49 -04:00
parent 25ba8156bc
commit a9888f6151
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 5 additions and 5 deletions

View file

@ -15,6 +15,8 @@ git-annex (7.20191115) UNRELEASED; urgency=medium
* benchmark --databases: Display size of the populated database.
* benchmark --databases: Improve the "addAssociatedFile to (new)"
benchmark to really add new values, not overwriting old values.
* Windows: Fix handling of changes to time zone. (Used to work but was
broken in version 7.20181031.)
-- Joey Hess <id@joeyh.name> Fri, 15 Nov 2019 11:57:19 -0400

View file

@ -187,16 +187,14 @@ genInodeCache f delta = catchDefaultIO Nothing $
toInodeCache :: TSDelta -> FilePath -> FileStatus -> IO (Maybe InodeCache)
toInodeCache (TSDelta getdelta) f s
| isRegularFile s = do
#ifndef mingw32_HOST_OS
delta <- getdelta
#endif
sz <- getFileSize' f s
#ifdef mingw32_HOST_OS
mtime <- MTimeHighRes . utcTimeToPOSIXSeconds <$> getModificationTime f
mtime <- utcTimeToPOSIXSeconds <$> getModificationTime f
#else
let mtime = (MTimeHighRes (modificationTimeHiRes s + highResTime delta))
let mtime = modificationTimeHiRes s
#endif
return $ Just $ InodeCache $ InodeCachePrim (fileID s) sz mtime
return $ Just $ InodeCache $ InodeCachePrim (fileID s) sz (MTimeHighRes (mtime + highResTime delta))
| otherwise = pure Nothing
{- Some filesystem get new random inodes each time they are mounted.