[ZODB-Dev] Re: ZODB-Dev Digest, Vol 6, Issue 19

Tim Peters tim at zope.com
Tue Sep 30 21:50:21 EDT 2003


[Martin Kretschmar]
> I don't have the source code ready, but I
> would like to point out that the Microsoft
> time() function is somewhat broken. E.g.
> it remembers somehow its timezone on its
> first call. So changing the timezone while
> a program is running results in extra trouble.
> Of course the WIN32 API calls work as they
> should. :| I also had always very reasonable
> millisecond values while working the the
> WIN32 API and remote procedure calls.
>
> So maybe the WIN32 Python implementation
> should be using this if not already does.

You should suggest Python changes on a Python forum.  Note that the Python
time.time() on Windows doesn't call the MS C time(), it calls the MS C
ftime().  The source code for that is included with MSVC 6.  It calls the
Win32 GetSystemTimeAsFileTime().  Since time.time() returns seconds since
the epoch, it should be insensitive to time zone changes (the current time
zone makes no difference to the result), and GetSystemTimeAsFileTime() is
documented as returning a UTC result.  MS ftime() *does* get time zone info
internally, but solely in order to set the dstflag member of its struct
_timeb result.  Python's time.time() ignores that member.




More information about the ZODB-Dev mailing list