A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2005-June/054499.html below:

[Python-Dev] Adding the 'path' module (was Re: Some RFE forreview)

[Python-Dev] Adding the 'path' module (was Re: Some RFE forreview) [Python-Dev] Adding the 'path' module (was Re: Some RFE forreview)Anders J. Munch ajm at flonidan.dk
Tue Jun 28 17:01:51 CEST 2005
> From: Guido van Rossum [mailto:gvanrossum at gmail.com]
> 
> >>> datetime.datetime.utcfromtimestamp(time.time()) - datetime.datetime.utcnow()
> datetime.timedelta(0)

I overlooked the utcfromtimestamp method, sorry.

> Your bug is similar to comparing centimeters to inches, or speed to
> acceleration, or any number of similar mistakes.

Quite so, and that is exactly the point.  time.time() unambiguously
identifies a point in time.  A datetime object does not.  At least not
unless a tzinfo object is included, and even then there is a corner
case at the end of DST that cannot possibly be handled.

If ctime/mtime/atime were to return datetime objects, that would
pretty much have to be UTC to not lose information in the DST
transition.  I doubt that's what Walter wanted though, as that would
leave users with the job of converting from UTC datetime to local
datetime; - unless perhaps I've overlooked a convenient UTC->local
conversion method?

- Anders
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4