[Python-Dev] Status on PEP-431 Timezones

Lennart Regebro regebro at gmail.com
Mon Jul 27 18:30:03 CEST 2015


On Mon, Jul 27, 2015 at 6:15 PM, Nikolaus Rath <Nikolaus at rath.org> wrote:
> On Jul 27 2015, Lennart Regebro <regebro at gmail.com> wrote:
>> That you add one hour to it, and the datetime moves forward one hour
>> in actual time? That's doable, but during certain circumstance this
>> may mean that you go from 1AM to 1AM, or from 1AM to 3AM.
>>
>> Or do you expect that adding one hour will increase the hour count
>> with one, ie that the "wall time" increases with one hour? This may
>> actually leave you with a datetime that does not exist, so that is not
>> something you can consistently do.
>
> Apologies for asking yet another dumb question about this, but I have
> the impression that a lot of other people are struggling with the basics
> here too.
>
> Can you tell us which of the two operations datetime currently
> implements?

It's intended that the first one is implemented, meaning that
datetime.now() + timedelta(hours=24) can result in a datetime
somewhere between 23 and 25 hours into the future. Or well, any
amount, in theory, I guess some changes are more than an hour, but
that's very unusual.

> And when people talk about explicitly converting to UTC and back, does
> that mean that if you're (again, with the current implementation)
> converting to UTC, *then* add the one hour, and then convert back, you
> get the other operation (that you don't get when you directly add 1
> day)?

Yes, exactly.

//Lennart


More information about the Python-Dev mailing list