You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Don't use east/west of UTC in date/time documentation #53551
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:
assignee=Noneclosed_at=Nonecreated_at=<Date2010-07-19.16:21:43.892>labels= ['easy', 'type-feature', 'docs']
title="Don't use east/west of UTC in date/time documentation"updated_at=<Date2022-03-05.16:55:35.124>user='https://github.com/abalkin'
I am opening this to supersede bpo-7229. See discussion following msg107148.
In many places offsets representing the difference between local time and UTC are described as minutes or seconds east or west of UTC. This is not correct because UTC is not a place and minutes and seconds don't measure distance in this context. Replacing UTC with the Prime Meridian will not fix that because some regions in the western hemisphere use positive offsets from UTC. or example, Madrid is at 3° 42' West, but uses Central European Time which is UTC+1.
I believe geographical references in the python documentation are irrelevant. What users are interested in is how to convert local time to UTC and UTC to local time rather than what is the sign of time.timezone in Madrid.
I suggest the following wording for time.timezone description:
time.timezone: The number of seconds one must add to the local time to arrive at UTC.
Similarly, tzinfo.utcoffset() can be defined as "Returns timedelta one must add to UTC to arrive at local time."
I suggest the following wording for time.timezone description:
time.timezone: The number of seconds one must add to the local time to arrive at UTC.
Makes sense. I can't see any other real explanation for -7200 value if
I am in +2 UTC timezone.
Similarly, tzinfo.utcoffset() can be defined as "Returns timedelta one must add to UTC to arrive at local time."
I believe the correct convention is "Return timedelta...". Another
concern - if UTC is 0 reference point then there is no reason to add
something to it - you just can say - "Return timedelta equal to local
UTC offset."
.. Another
concern - if UTC is 0 reference point then there is no reason to add
something to it - you just can say - "Return timedelta equal to local
UTC offset."
No, UTC is not a 0 reference point, it is a time scale. UTC offset is
the value that is used to translate between time expressed in UTC and
local time. To make an analogy, expressing time in UTC is like
expressing temperature in Kelvin scale. You need to subtract 273 from
the value in ºK to arrive at the value in ºC.
Documenting utcoffset() as "Return timedelta equal to local UTC
offset." is almost circular. It does not explain whether it has to be
added or subtracted from UTC to arrive at local time.
FYI, I like the change. As I recall it, the current wording was just to avoid saying "ahead of UTC" or "behind UTC" (which was the original wording). Technically pure or not, I never saw anyone get truly confused by "East of UTC" or "West of UTC", but I fully that what people really want to know is what to do with the thing (add or subtract it).
On Tue, Jul 20, 2010 at 10:46 AM, anatoly techtonik <techtonik@gmail.com> wrote:
I believe the correct convention is "Return timedelta...".
This is handled inconsistently in the documentation; I'm hoping the
current maintainers reinforce the "Returns ..." structure. The
documentation is descriptive, not an external specification.
-Fred
techtonik commented on Jul 20, 2010
techtonikmannequin
Mannequin
More actions
Documenting utcoffset() as "Return timedelta equal to local UTC
offset." is almost circular. It does not explain whether it has to be
added or subtracted from UTC to arrive at local time.
Ok. Sold.
> I believe the correct convention is "Return timedelta...".
This is handled inconsistently in the documentation; I'm hoping the
current maintainers reinforce the "Returns ..." structure. The
documentation is descriptive, not an external specification.
.. As I recall it, the current wording was just to avoid saying "ahead of UTC" or "behind UTC" (which was the original wording).
Interesting. I actually like the original wording better. For me,
"my watch is 6 hours behind UTC" makes it clear that when the Big Ben
clock shows tea time (18:00), my watch displays noon (17:00 - 6:00 =
12:00.)
I wonder if east/west is somehow more natural for native speakers of
English. I would really like to hear more from the international
audience. When it comes to measuring time there are many interesting
traditions that don't translate well between nations. For example,
I've heard that in the Far East, the future is considered to be behind
because you can see the past but you cannot see the future. If this
is the notion that you are used to, time being ahead or behind can be
truly confusing.
On Tue, Jul 20, 2010 at 12:14 PM, Alexander Belopolsky
<report@bugs.python.org> wrote:
..
Interesting. I actually like the original wording better. For me,
"my watch is 6 hours behind UTC" makes it clear that when the Big Ben
clock shows tea time (18:00), my watch displays noon (17:00 - 6:00 =
12:00.)
I was too excited to add Alice in Wonderland humor to my post that did
not get the math right. :-)
The above should read 18:00 - 6:00 = 12:00, of course. Or was it five
o'clock after all?
Here goes a patch to replace east/west references on datetime documentation.
As spoken with fdrake we think the datetime documentation could be improved extracting the timezone subclassing details to specific section. We'll be filling a new issue for that patch.
On the second reading, I have a few issues with the patch.
Please run makepatcheck. There are whitespace issues in datetime.rst.
In docstrings, you remove the information about the sign. I would not mind leaving docstrings the way they are. Otherwise, please add a short sentence explaining the sign of utcoffset and dst.
"This represents the offset in minutes that must be added to the local time zone to follow DST rules." This unclear. DST offset is added to the "standard time", not "local time zone". (I am not sure if "standard time" is defined in the manual, though.) Also, "in minutes" is not necessary - timedelta carries the units. You can add that only offsets that are multiples of a minute are supported.
henriquebastos commented on Nov 20, 2010
henriquebastosmannequin
Mannequin
More actions
To clarify:
"we" means henriquebastos, rbp, Rodolpho.Eckhardt.
Mentioning fdrake I was trying to say that we followed his suggestion to only submit the specific changes on this patch, leaving further documentation changes to another issue.
Sorry about any inconvenience.
rbp commented on Nov 20, 2010
rbpmannequin
Mannequin
More actions
Done (it's on the patch I'm uploading). Sorry.
Ok, we've rewritten that sentence. As Henrique mentioned, we're working on a larger patch to make datetime documentation clearer, and we can include a definition of "standard time" there.
I assume you're talking about sentences like "(negative for west of UTC)". We removed that wording because it inevitably leads to associating UTC with a geographical reference. Even if we disregard that, it's not true that "utcoffset is negative west of UTC", since it will we zero for for UTC-1 (and even +1 for places physically "west of UTC" but at timezone UTC+0) when DST is effective.
It seems that any sentence we add to that effect will be simply restating the definitions of UTC, timezones and DST (and their mathematical relationships). That is, "utcoffset will be negative when dt.tzinfo + dst() is negative".
Perhaps we could include a more detailed discusion about the sign of utcoffset() on the larger doc patch I've mentioned? Or do you have any suggestions?
I've noticed that the time module docstring handles this issue rather nicely:
>>> help('time')
...
timezone -- difference in seconds between UTC and local standard time
altzone -- difference in seconds between UTC and local DST time
We can use similar language for utcoffset(): "difference between local time and UTC expressed as a timedelta".
BreamoreBoy commented on Mar 30, 2013
BreamoreBoymannequin
Mannequin
More actions
Well, we have a patch and it's been discussed here and on bpo-7229, so can we take this forward?
Activity
abalkin commentedon Jul 19, 2010
I am opening this to supersede bpo-7229. See discussion following msg107148.
In many places offsets representing the difference between local time and UTC are described as minutes or seconds east or west of UTC. This is not correct because UTC is not a place and minutes and seconds don't measure distance in this context. Replacing UTC with the Prime Meridian will not fix that because some regions in the western hemisphere use positive offsets from UTC. or example, Madrid is at 3° 42' West, but uses Central European Time which is UTC+1.
I believe geographical references in the python documentation are irrelevant. What users are interested in is how to convert local time to UTC and UTC to local time rather than what is the sign of time.timezone in Madrid.
I suggest the following wording for time.timezone description:
time.timezone: The number of seconds one must add to the local time to arrive at UTC.
Similarly, tzinfo.utcoffset() can be defined as "Returns timedelta one must add to UTC to arrive at local time."
techtonik commentedon Jul 20, 2010
On Mon, Jul 19, 2010 at 7:21 PM, Alexander Belopolsky
<report@bugs.python.org> wrote:
Makes sense. I can't see any other real explanation for -7200 value if
I am in +2 UTC timezone.
I believe the correct convention is "Return timedelta...". Another
concern - if UTC is 0 reference point then there is no reason to add
something to it - you just can say - "Return timedelta equal to local
UTC offset."
abalkin commentedon Jul 20, 2010
On Tue, Jul 20, 2010 at 10:46 AM, anatoly techtonik
<report@bugs.python.org> wrote:
No, UTC is not a 0 reference point, it is a time scale. UTC offset is
the value that is used to translate between time expressed in UTC and
local time. To make an analogy, expressing time in UTC is like
expressing temperature in Kelvin scale. You need to subtract 273 from
the value in ºK to arrive at the value in ºC.
Documenting utcoffset() as "Return timedelta equal to local UTC
offset." is almost circular. It does not explain whether it has to be
added or subtracted from UTC to arrive at local time.
tim-one commentedon Jul 20, 2010
FYI, I like the change. As I recall it, the current wording was just to avoid saying "ahead of UTC" or "behind UTC" (which was the original wording). Technically pure or not, I never saw anyone get truly confused by "East of UTC" or "West of UTC", but I fully that what people really want to know is what to do with the thing (add or subtract it).
freddrake commentedon Jul 20, 2010
On Tue, Jul 20, 2010 at 10:46 AM, anatoly techtonik <techtonik@gmail.com> wrote:
This is handled inconsistently in the documentation; I'm hoping the
current maintainers reinforce the "Returns ..." structure. The
documentation is descriptive, not an external specification.
-Fred
techtonik commentedon Jul 20, 2010
Ok. Sold.
http://www.python.org/dev/peps/pep-0257/#one-line-docstrings
I've took the convention from here. I thought docs are generated from
docstrings.
freddrake commentedon Jul 20, 2010
On Tue, Jul 20, 2010 at 12:08 PM, anatoly techtonik
<report@bugs.python.org> wrote:
They're not, but I don't think that really matters.
Older documentation used the imperative form consistently, but that's
shifted over time. (I, at least, think that's a good thing.)
I don't think it really matters with regard to this issue.
abalkin commentedon Jul 20, 2010
On Tue, Jul 20, 2010 at 11:39 AM, Tim Peters <report@bugs.python.org> wrote:
Interesting. I actually like the original wording better. For me,
"my watch is 6 hours behind UTC" makes it clear that when the Big Ben
clock shows tea time (18:00), my watch displays noon (17:00 - 6:00 =
12:00.)
I wonder if east/west is somehow more natural for native speakers of
English. I would really like to hear more from the international
audience. When it comes to measuring time there are many interesting
traditions that don't translate well between nations. For example,
I've heard that in the Far East, the future is considered to be behind
because you can see the past but you cannot see the future. If this
is the notion that you are used to, time being ahead or behind can be
truly confusing.
abalkin commentedon Jul 20, 2010
On Tue, Jul 20, 2010 at 12:14 PM, Alexander Belopolsky
<report@bugs.python.org> wrote:
..
I was too excited to add Alice in Wonderland humor to my post that did
not get the math right. :-)
The above should read 18:00 - 6:00 = 12:00, of course. Or was it five
o'clock after all?
abalkin commentedon Jul 20, 2010
On Tue, Jul 20, 2010 at 12:08 PM, anatoly techtonik
<report@bugs.python.org> wrote:
..
Good. All we need now is just a patch. :-)
henriquebastos commentedon Nov 20, 2010
Here goes a patch to replace east/west references on datetime documentation.
As spoken with fdrake we think the datetime documentation could be improved extracting the timezone subclassing details to specific section. We'll be filling a new issue for that patch.
4 remaining items
abalkin commentedon Nov 20, 2010
On the second reading, I have a few issues with the patch.
henriquebastos commentedon Nov 20, 2010
To clarify:
"we" means henriquebastos, rbp, Rodolpho.Eckhardt.
Mentioning fdrake I was trying to say that we followed his suggestion to only submit the specific changes on this patch, leaving further documentation changes to another issue.
Sorry about any inconvenience.
rbp commentedon Nov 20, 2010
Done (it's on the patch I'm uploading). Sorry.
Ok, we've rewritten that sentence. As Henrique mentioned, we're working on a larger patch to make datetime documentation clearer, and we can include a definition of "standard time" there.
I assume you're talking about sentences like "(negative for west of UTC)". We removed that wording because it inevitably leads to associating UTC with a geographical reference. Even if we disregard that, it's not true that "utcoffset is negative west of UTC", since it will we zero for for UTC-1 (and even +1 for places physically "west of UTC" but at timezone UTC+0) when DST is effective.
It seems that any sentence we add to that effect will be simply restating the definitions of UTC, timezones and DST (and their mathematical relationships). That is, "utcoffset will be negative when dt.tzinfo + dst() is negative".
Perhaps we could include a more detailed discusion about the sign of utcoffset() on the larger doc patch I've mentioned? Or do you have any suggestions?
abalkin commentedon Jan 11, 2011
I've noticed that the time module docstring handles this issue rather nicely:
We can use similar language for utcoffset(): "difference between local time and UTC expressed as a timedelta".
BreamoreBoy commentedon Mar 30, 2013
Well, we have a patch and it's been discussed here and on bpo-7229, so can we take this forward?
abalkin commentedon Jun 29, 2014
This seems to be touching the same areas as bpo-9305.
vadmium commentedon Jan 10, 2016
Assuming you meant bpo-8810, yes these patches would collide with each other. I am yet to look at the patches, but I gess they should be merged.
csabella commentedon Oct 24, 2017
Would one of the original authors of the patches like to create a GitHub pull request for this issue?
AjayMahato commentedon Jan 4, 2019
I would like to work on this issue. Please assign this to me.
AjayMahato commentedon Jan 5, 2019
I am taking up this issue.
crwilcox commentedon Feb 10, 2020
Are you still working on this Ajay Mahato?
slateny commentedon May 12, 2022
Closed per comment