[Python-Dev] PEP: New timestamp formats (original) (raw)

Victor Stinner victor.stinner at haypocalc.com
Sat Feb 4 01:34:33 CET 2012


I don't see any real issue of adding datetime as another accepted type, if Decimal is also accepted. Each type has limitations, and the user can choose the best type for his/her use case.

I dropped datetime because I prefer incremental changes (and a simpler PEP is also more easily accepted :-)). We can add datetime later when most developers agree that datetime issues are no more issues :-)

About incremental changes, I wrote a patch (timestamp_datetime.patch) to support the datetime.datetime type using my API: http://bugs.python.org/issue13882#msg152571

Example:

$ ./python

import datetime, os, time open("x", "wb").close(); print(datetime.datetime.now()) 2012-02-04 01:17:27.593834 print(os.stat("x", timestamp=datetime.datetime).stctime) 2012-02-04 00:17:27.592284+00:00 print(time.time(timestamp=datetime.datetime)) 2012-02-04 00🔞21.329012+00:00 time.clock(timestamp=datetime.datetime) ValueError: clock has an unspecified starting point print(time.clockgettime(time.CLOCKREALTIME, timestamp=datetime.datetime)) 2012-02-04 00:21:37.815663+00:00 print(time.clockgettime(time.CLOCKMONOTONIC, timestamp=datetime.datetime)) ValueError: clock has an unspecified starting point

I still don't know if using UTC is correct.

Victor



More information about the Python-Dev mailing list