Determining actual elapsed (wall-clock) time

Tim Peters tim.peters at gmail.com
Sat Jul 2 19:44:19 EDT 2005


[Peter Hansen]
> Hmmm... not only that, but at least under XP the return value of
> time.time() _is_ UTC.  At least, it's entirely unaffected by the
> daylight savings time change, or (apparently) by changes in time zone.

On all platforms, time.time() returns the number of seconds "since the
epoch".  All POSIX systems agree on when "the epoch" began, but that
doesn't really matter to your use case.  Number of seconds since the
epoch is insensitive to daylight time, time zone, leap seconds, etc. 
Users can nevertheless make it appear to jump (into the future or the
past) by changing their system clock.  If you need an absolute measure
of time immune to user whims, you need to connect to special hardware,
or to an external time source.



More information about the Python-list mailing list