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?
This commit is contained in:
Joey Hess 2019-11-06 14:36:49 -04:00
parent 89bdcffdfa
commit 09ee6b0ccb
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 5 additions and 5 deletions

View file

@ -7,6 +7,8 @@ git-annex (7.20191025) UNRELEASED; urgency=medium
some things involving export and import remotes, and git-annex smudge. some things involving export and import remotes, and git-annex smudge.
* Improved serialization of filenames and keys to the sqlite databases, * Improved serialization of filenames and keys to the sqlite databases,
avoiding some encoding problems. avoiding some encoding problems.
* Windows: Fix handling of changes to time zone. (Used to work but was
broken in version 7.20181031.)
-- Joey Hess <id@joeyh.name> Tue, 29 Oct 2019 15:13:03 -0400 -- Joey Hess <id@joeyh.name> Tue, 29 Oct 2019 15:13:03 -0400

View file

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