Technically, time.time() doesn't specify, and practically, at least in CPython, it returns a timestamp in whatever format is used by the underlying standard C library's time
function.
The C standard (which isn't freely available) doesn't say whether this is GMT, and neither does the POSIX standard. It just says:
The time()
function shall return the value of time in seconds since the Epoch.
… without saying anything about timezone, except that you can pass it to localtime
or gmtime
to get a "broken-down time" in local or GMT timezones.
So, this is platform-specific. A platform can return anything it wants for time
, as long as it does so in a way that makes localtime
and gmtime
work properly.
That being said, it's usually going to be GMT—or, rather, either UTC (Windows), or UTC-except-for-leap-seconds (most other platforms). For example, FreeBSD says:
The time()
function returns the value of time in seconds since 0 hours, 0 minutes, 0 seconds, January 1, 1970, Coordinated Universal Time, without including leap seconds.
OS X and most other *BSDs have the same manpage, Windows and linux/glibc also specifically return UTC (with or without leap seconds), etc.
Also, the Python documentation says:
To find out what the epoch is, look at gmtime(0)
.
Putting that together with the definitions for time
and gmtime
, it would be much more work for a platform to return local timestamps than GMT. (That being said, this statement can't be all that authoritative, because it's actually not quite true for any POSIX platform, thanks to leap seconds.)