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
Don't lie about time #570
Comments
Hi, I don't think there's any such thing as a I'm not sure it's 'wrong' to assume the host's timezone if there's no timezone supplied, given there has to be a timezone. Remember, if you've got a ZIP archive, you are probably going to be copying the files out of it into your local filesystem, which will be using your local timezone anyway. If coordinating timestamps across different timezones is important, then using the Even then I do think the I'm sorry that this probably doesn't address your issue above, but I think we currently strike a reasonable balance given the constraints we have. |
Ruby doesn't have any built-in class that has Time without timezone and
Yeah but it will be converted wrongly to local time. I don't really care about timezone itself, but without that information you can't determine which file is newer or older when comparing 2 zip files. For example user in California creates zip file with local time
It would return system's UTC offset but that doesn't matter, the goal is to distinguish between correct time (with timezone, can be easily converted to UTC or whichever) and time without one which can only be based on guesses. This issue is not present if everyone's Zip files contains With |
OK, so I think you just need a way to know if the timezone within a Perhaps we could add a |
Funnily enough, now I look at the code that decodes times out of the extra fields I think there's a bug. It's not reading the times in UTC but assuming local timezone... Oh dear, I better check and fix that for v3.0. |
Yeah exactly, but I'm not sure if
Before submitting this issue I actually looked into that as it seemed so but actually the time itself is correct because you use |
Ah yes, Unix timestamps are always in UTC. That's a relief... |
So, would |
Yes that would work, because then you can do something like time = entry.mtime
if !entry.absolute_time?
time = ... # fix mtime based on some logic
end But my thinking was that it should belong to Zip Time class so |
Yes, I was wondering about having I think it's possible to argue that it's a property of both the time itself (was this time object created with accurate timezone information?) and the I'll look at this. |
Hi @davispuh, if you are able to test something, then I've added In short:
|
Hi,
Currently if you work with zip file that doesn't use
UniversalTime/NTFS
butDOSTime
then you don't actually know correct timestamp due to missing timezone but currentlyrubyzip
would use local timezone which is wrong. I would rather have aTime
type without any timezone specified as then I can convert to some better guess at application layer and take into account other data points (eg. which user uploaded zip and so on).The main issue with current implementation is that some zip files do contain good timestamp (
UniversalTime/NTFS
) so you can't always assume it's wrong.I think Time APIs should either return Ruby's
Time
(when it's correct) orDOSTime
when it's not known.Currently I have worked around this issue like this but it seems quite hacky...
The text was updated successfully, but these errors were encountered: