Message76340
Ooops, timestamp (c) is the *Mac* timestamp: seconds since the 1st
january 1904.
> what is your conclusion?
Hum, it's maybe not possible to choose between integer and float. Why
not supporting both? Example:
- totimestamp()->int: truncate microseconds
- totimestamp(microseconds=True)->float: with microseconds
Attached file (timestamp.py) is a module to import/export timestamp in
all listed timestamp formats. It's written in pure Python.
----------------
>>> import timestamp
>>> from datetime import datetime
>>> now = datetime.now()
>>> now
datetime.datetime(2008, 11, 24, 18, 7, 50, 216762)
>>> timestamp.exportUnix(now)
1227550070
>>> timestamp.exportUnix(now, True)
1227550070.2167621
>>> timestamp.exportMac(now)
3310394870L
>>> timestamp.exportWin64(now)
128720236702167620L
>>> timestamp.exportUUID(now)
134468428702167620L
>>> timestamp.importMac(3310394870)
datetime.datetime(2008, 11, 24, 18, 7, 50)
>>> timestamp.importUnix(1227550070)
datetime.datetime(2008, 11, 24, 18, 7, 50)
>>> timestamp.importUnix(1227550070.2167621)
datetime.datetime(2008, 11, 24, 18, 7, 50, 216762)
----------------
It supports int and float types for import and export. |
|
Date |
User |
Action |
Args |
2008-11-24 17:13:44 | vstinner | set | recipients:
+ vstinner, tebeka, davidfraser, belopolsky, andersjm, werneck, hodgestar, Neil Muller |
2008-11-24 17:13:43 | vstinner | set | messageid: <1227546823.91.0.931359618478.issue2736@psf.upfronthosting.co.za> |
2008-11-24 17:13:43 | vstinner | link | issue2736 messages |
2008-11-24 17:13:42 | vstinner | create | |
|