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


Groups > comp.lang.python > #64947

Re: pytz question: GMT vs. UTC

From Ben Finney <ben+python@benfinney.id.au>
Subject Re: pytz question: GMT vs. UTC
Date 2014-01-30 05:45 +1100
References <CANc-5UwG556iz9qewe2Ltw-TzsGt3EA0CXqq9R85Di-DVg8MEA@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.6095.1391021168.18130.python-list@python.org> (permalink)

Show all headers | View raw


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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web