-
-
Notifications
You must be signed in to change notification settings - Fork 32k
bpo-43869: Time Epoch is the same on all platforms #30664
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
Conversation
The Python test suite checks that the Epoch is 1970-01-01 at 00:00 since 2008! It's tested indirectly by test_structseq since this change:
Test:
|
Add an explicit test_epoch() test in test_time.
# bpo-43869: Make sure that Python use the same Epoch on all platforms: | ||
# January 1, 1970, 00:00:00 (UTC). | ||
epoch = time.gmtime(0) | ||
# Only test the date and time, ignore other gmtime() members |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could test more members, but I don't think that it is worth it. It can make the test more fragile if the exact value changes depending on the platform.
Doc/library/time.rst
Outdated
``time.gmtime(0)``. | ||
* The :dfn:`epoch` is the point where the time starts. | ||
It is January 1, 1970, 00:00:00 (UTC) on all platforms. | ||
To find out what the epoch is, look at ``time.gmtime(0)``. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This reads a bit strange now - you tell us exactly what the epoch is, and then tell us how to find out what it is. How about changing the above 3 lines to something like:
- The :dfn:
epoch
is the point where the time starts, the
return value oftime.gmtime(0)
.
It is January 1, 1970, 00:00:00 (UTC) on all platforms.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that the doc sounds strange. But I wanted to keep "gmtime(0)", it sounds important to me. I like your wording, I copied it in my PR ;-) Would you mind to review it again?
Thanks for the suggestion Irit, and thanks for the review Irit and Paul ;-) |
|
Add an explicit test_epoch() test in test_time.
https://bugs.python.org/issue43869