[Python-Dev] Status on PEP-431 Timezones
tseaver at palladion.com
Tue Jul 28 14:06:03 CEST 2015
-----BEGIN PGP SIGNED MESSAGE-----
On 07/27/2015 09:36 PM, Tim Peters wrote:
> So what do _you_ do with datetime arithmetic, Tres? Do you do
> datetime calculations at all, or just store/retrieve values as-is?
> If the former, are you disturbed that adding timedelta(hours=24) to
> an aware datetime object never changes the time components (only the
> day, and possibly also month, and possibly also year)? If that has
> disturbed you, did you find a way to accomplish what you wanted
> instead - or are you still stuck? ;-)
Sample use cases:
- - Embargo a pre-prepared story until 8:00 AM US/Central next Monday.
- - Likewise, but allow it to run for three weeks.
- - Create a recurring event which occurs from 7:00 - 9:00 PM US/Eastern on
the last Thursday of each month.
- - Issue a bid for a commodity lot N days before its expiration date;
update that bid (if another bid has occurred) at the same time each
day until expiration.
- - Mark messages published on a distributed event channel to allow clients
to sequence them unambiguously.
- - For a given sequence of events: if no subsequent matching event occurs
within five calendar days of the last event in the sequence, issue a
"resolved" event, terminating the sequence.
- - The same, except define the interval using "business days" (including
applying a user-defined holiday calendar).
- - Measure / bucket widgets produced across multiple production lines by
quarter / month / day / shift / hour, and generate reports comparing
results week-over-week, quarter-over-quarter, etc.
In none of those cases involving "days" was the "one day is 24 hours,
exactly" a sufficient approximation, and none of them could tolerate naive
datetimes. Typically, the application used a "date interval" object (or a
recurrence object) which generated date offsets without assuming that a
"day" was 86400 seconds.
Tres Seaver +1 540-429-0999 tseaver at palladion.com
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
-----END PGP SIGNATURE-----
More information about the Python-Dev