On Tue, Jul 28, 2015 at 8:11 AM, Tim Peters <tim.pet...@gmail.com> wrote:
> [Tim]
>>> timedelta objects only store days, seconds, and microseconds,
>
> [Lennart Regebro <rege...@gmail.com>]
>> Except that they don't actually store days. They store 24 hour
>> periods,
>
> Not really.  A timedelta is truly an integer number of microseconds,
> and that's all.

That's what I said. Timedeltas, internally assume that 1 day is 24
hours. Or 86400000 microseconds. That's the assumption internally in
the timedelta object.

The problem with that being that in the real world that's not true.

> 24 hours is 24 hours at any time in _any_ time zone, ignoring leap
> seconds.  timedeltas are durations, not points in time.  "time zones"
> make no sense applied to durations.

My point exactly.

And should not then adding 86400000 microseconds to a datetime
actually result in a datetime that happens 86400000 microseconds
later?

>> ie, it assumes that one day is always 24 hours.
>
> That's really not what it's doing

That is really exactly what the timedelta is doing, as you yourself,
just a few lines above say.

> used in explanations.  What somedatetime+timedelta really does is
> simpler than that:  it adds the number of microseconds represented by
> the timedelta to somedatetime,

No it doesn't.
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to