Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #64947 > unrolled thread

Re: pytz question: GMT vs. UTC

Started byBen Finney <ben+python@benfinney.id.au>
First post2014-01-30 05:45 +1100
Last post2014-01-30 05:45 +1100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: pytz question: GMT vs. UTC Ben Finney <ben+python@benfinney.id.au> - 2014-01-30 05:45 +1100

#64947 — Re: pytz question: GMT vs. UTC

FromBen Finney <ben+python@benfinney.id.au>
Date2014-01-30 05:45 +1100
SubjectRe: pytz question: GMT vs. UTC
Message-ID<mailman.6095.1391021168.18130.python-list@python.org>
Skip Montanaro <skip@pobox.com> writes:

> According ato the pytz doc (http://pytz.sourceforge.net/):
>
> "‘UTC’ is Universal Time, also known as Greenwich Mean Time or GMT in
> the United Kingdom."

This is inaccurate, and I'd like to see it corrected in the
documentation. UTC is neither UT nor GMT.

GMT is not precisely defined, which makes it unsuitable for keeping
precise time in a computer system.

> If they are equal, why don't timezone objects created from those two
> strings compare equal?
>
> >>> pytz.timezone("UTC") == pytz.timezone("GMT")
> False

Python is correct, the timezones are not the same.

See <URL:https://en.wikipedia.org/wiki/Coordinated_Universal_Time> and
<URL:https://en.wikipedia.org/wiki/Greenwich_Mean_Time>. From the
former:

    Saying "GMT" often implies either UTC or UT1 when used within
    informal or casual contexts. In technical contexts, usage of "GMT"
    is avoided; the unambiguous terminology "UTC" or "UT1" is preferred.

> (I'm revealing my complete ignorance of timezone manipulation by
> asking this question.)

Treat GMT like any other locale-specific timezone, and convert to/from
it as late/early as possible (like a locale-specific encoding).

Treat UTC as the canonical timezone for keeping all timestamp values in
(like Unicode for text).

-- 
 \     “Reality must take precedence over public relations, for nature |
  `\                            cannot be fooled.” —Richard P. Feynman |
_o__)                                                                  |
Ben Finney

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web