From a9888f6151be12807a75a5b97958eeb0c59f5f1d Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 6 Nov 2019 14:36:49 -0400 Subject: [PATCH] Windows: Fix handling of changes to time zone. Used to work but was broken in version 7.20181031, specifically commit 5ab0f48ffbd69029feb8cd101776c46ec86d6209. 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 09ee6b0ccb10059d44fd9a89f07646b35b718563) --- CHANGELOG | 2 ++ Utility/InodeCache.hs | 8 +++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index f33e291be6..5935c5f32f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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 Fri, 15 Nov 2019 11:57:19 -0400 diff --git a/Utility/InodeCache.hs b/Utility/InodeCache.hs index 0eac8a3018..97245b3493 100644 --- a/Utility/InodeCache.hs +++ b/Utility/InodeCache.hs @@ -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.