-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
datetime.utctimetuple() should not set tm_isdst flag to 0 #53250
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
Comments
I find the following quite misleading: >>> from datetime import datetime
>>> import time
>>> time.strftime('%c %z %Z', datetime.utcnow().utctimetuple())
'Wed Jun 16 03:26:26 2010 -0500 EST' As far as I can tell, the only other function that uses the tm_isdst flag is time.mktime, but it expect a timetuple containing local time, not UTC time. |
With timezone.utc available in datetime module, users should be encouraged to use dt.astimezone(timezone.utc).timetuple() instead of dt.utctimetuple(). Note that the later will set tm_isdst to -1. This observation can be used to argue for either of two ways to resolve this issue:
I am leaning towards #1, but would like to hear from others. |
|
Reclassifying this as a doc issue. |
Hi, Please let me know if it is correct or needs changes. Regards, |
Please can you convert your patch to a pull request on github. |
I submitted Gaurav's patch as PR 10870. Please review. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: