On Mon, Jun 4, 2012 at 1:12 PM, Guido van Rossum <gu...@python.org> wrote:
> ...  I heard
> a colleague complain that he'd lost several hours trying to figure out
> how to determine whether two datetimes were within 24h of each other,
> getting confused by what was happening when the two were on different
> sides of a DST transition (or worse, in the middle of one).

I don't think this is a problem that a general purpose module such as
datetime can resolve.  Assuming that all instances are timezone aware,
either of the following tests may be appropriate for a given
application:

1) dt1 - dt2 == timedelta(1)

2) dt1.date() - dt2.date() == timedelta(1) and dt1.time() == dt2.time()

If your application deals with physical processes - (1) may be
appropriate, but if it deals with human schedules - (2) may be
appropriate.

The only right solution is to lobby your government to abandon the DST.
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to