[Python-Dev] Subsecond time stamps

Jack Jansen Jack.Jansen@oratrix.com
Sun, 8 Sep 2002 23:51:59 +0200

On zondag, september 8, 2002, at 01:24 , Guido van Rossum wrote:
> Would it make sense if the portable Python APIs translated everything
> to an epoch of 1970 and UTC?  That's what the Windows C library does.
> Very helpful.  (Or is this a problem that's going to disappear with
> MacOS X?  I presume it uses UTC and I hope its epoch is 1970?)

On MacOSX (if you use unix-based Python, not if you use old 
MacPython) the problem is gone. At least, if you ignore the 
timestamps returned by mac-specific filesystem routines, but I 
think we can do that safely.

Changing the APIs to return unix-style timestamps is what the 
GUSI unix-compatible socket and I/O library used by MacPython 
did originally, but I had to rip it out. The problem was that 
GUSI did provide all the unix system calls, but not the other 
library routines that handled timestamps. So these were provided 
by the Metrowerks C library, which assumes localtime. So ctime() 
and gmtime() and all its friends did the wrong thing, and I 
didn't cherish the idea of finding replacements for them.

If your suggestion is that every timestamp goes through a 
conversion routine before being passed from C to Python and 
through a reverse conversion when it goes from Python to C: yes, 
that would definitely make sense.
- Jack Jansen        <Jack.Jansen@oratrix.com>        
http://www.cwi.nl/~jack -
- If I can't dance I don't want to be part of your revolution -- 
Emma Goldman -