[Python-Dev] Proposing an alternative to PEP 410 (original) (raw)
Guido van Rossum guido at python.org
Fri Feb 24 01:43:49 CET 2012
- Previous message: [Python-Dev] Proposing an alternative to PEP 410
- Next message: [Python-Dev] Proposing an alternative to PEP 410
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu, Feb 23, 2012 at 3:47 PM, Larry Hastings <larry at hastings.org> wrote:
On 02/23/2012 02:35 PM, Victor Stinner wrote: > For os.stat(), you should use the UTC timezone, not a naive datetime.
Why is that more appropriate? IIUC, timestamps ignore leap seconds and strictly represent "seconds since the epoch". In order to correctly return a time in the UTC time zone we'd have to adjust for leap seconds. Naive datetimes bask in their happy ignorance of such complexities.
You seem to have the meaning of "ignore leap seconds" backwards. POSIX timestamps are not literally seconds since the epoch. They are non-leap seconds since the epoch, which is just what you want. IOW the simple calculation ignoring leap seconds (found e.g. in calendar.py) will always produce the right value.
-- --Guido van Rossum (python.org/~guido)
- Previous message: [Python-Dev] Proposing an alternative to PEP 410
- Next message: [Python-Dev] Proposing an alternative to PEP 410
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]