Skip to content
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

Wrong timestamp parsed from last-modified header #15

Closed
tomers opened this issue May 31, 2020 · 2 comments · Fixed by #16
Closed

Wrong timestamp parsed from last-modified header #15

tomers opened this issue May 31, 2020 · 2 comments · Fixed by #16

Comments

@tomers
Copy link

tomers commented May 31, 2020

I reside in UTC+03. When I use the update.py script:

>>> import time
>>> from email.utils import parsedate
>>> lastmod = "Thu, 28 May 2020 16:40:36 GMT"
>>> parsedate(lastmod)
(2020, 5, 28, 16, 40, 36, 0, 1, -1)  # <-- ok
>>> time.mktime(parsedate(lastmod))
1590673236.0  # <-- not ok! 3 hours offset (caused by my TZ)

# 1590673236 is "Thursday, May 28, 2020 1:40:36 PM GMT" (notice the 3 hours difference, caused by my TZ)
# should be 1590684036

A resolution for this is to replace time.mktime() with calendar.timegm().
Reference: https://docs.python.org/3/library/time.html#index-4

@ko-zu
Copy link
Owner

ko-zu commented May 31, 2020

Merged. thanks for your contributions.

@tomers
Copy link
Author

tomers commented Jun 1, 2020

Thanks! Can you please release a new version with this fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants