-
-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Correct way to specify last modified date? #67
Comments
Here's what the Haddocks say: , eLastModified :: !Integer -- ^ Modification time (seconds since unix epoch) We just have this one field. modEpochTime <- (floor . utcTimeToPOSIXSeconds) <$> getModificationTime path Can you see a problem here? |
PS |
I guess I'd assumed that "seconds since the unix epoch" means "relative to UTC time." Could it be that it is interpreted relative to local time? |
I might have just used UTC because this library exports pure functions (no IO) -- hence no way to get the locale's time zone. We could, however, make it a parameter on one of the exported functions. |
https://en.wikipedia.org/wiki/Unix_time
https://www.epochconverter.com/clock this seems to be correct with that definition and provides the exact time as returned by If we sticked with this definition, then a number So at least in theory it all seems to be done correctly. But I don't understand why |
https://www.ghisler.ch/board/viewtopic.php?t=80315
|
So, apparently |
Anyways, the fact that zipping with |
Actually, the line I quoted above comes from |
OK, I think I've fixed this. Can you test as well? The fix only affects |
If it looks okay, we can do a new release. |
Yes, this might be a solution. However, I still use the pure |
If you use pure |
WARNING: This sets the last mod time as UTC. Issue filed here for explanation: jgm/zip-archive#67
Hello,
I'm using
zip-archive
version 0.4.3.I have this pseudocode:
So basically this should create a zip file with some entry where
last modified
is current local time. However, from what I see in my archive viewer, thelast modified
time is set to UTC.To be more precise:
st <- getSystemTime systemToUTCTime st
returns
2024-04-04 10:05:34 UTC
currently. The local time is12:05:34
. So thest
value is correct. However, the zip file shows10:05:34
LOCAL time.I see that the C library differentiates between
zip_file_set_mtime
andzip_file_set_dostime
(https://libzip.org/documentation/zip_file_set_mtime.html):Since
zip-archive
is a native Haskell library, I'm guessing that there are 2 different fields for this? Maybe we set the wrong one?The text was updated successfully, but these errors were encountered: