This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Documentation of time.time() differs from source documentation
Type: Stage:
Components: Documentation Versions: Python 2.5
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: cgrohmann, georg.brandl, loewis
Priority: normal Keywords:

Created on 2008-06-24 05:53 by cgrohmann, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (4)
msg68666 - (view) Author: Carsten Grohmann (cgrohmann) Date: 2008-06-24 05:53
The current python documentation of the time module
(http://docs.python.org/lib/module-time.html) means that time.time()
returns the "seconds since the epoch, in UTC".

But in the current source documentation of the time module
(http://svn.python.org/view/python/trunk/Modules/timemodule.c?rev=64048&view=markup)
is written that "time() -- return current time in seconds since the Epoch". 

time.time() returns the current local unix seconds during tests on a
system using Python 2.5.

Please adapt the documentation.

Thanks,
Carsten
msg68667 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2008-06-24 06:14
I cannot see the difference. The docstring doesn't say "current local
time", it says "current time". What do you mean by "current local unix
seconds" - that phrase makes no sense.

time.time() returns the seoncds since the Epoch, and they must be
interpreted in UTC, always. So both documentation texts are correct, and
they say the same thing.
msg68668 - (view) Author: Carsten Grohmann (cgrohmann) Date: 2008-06-24 06:51
"current local unix seconds" means seconds since the Epoch in local
timezone.

I've attached a small example to show that is no difference between the
time returned by time.localtime() and time.time(). So I assume that
time.time() also returns local time and not UTC.

>>> time.mktime(time.localtime())
1214290130.0
>>> time.time()
1214290130.697067
msg68671 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2008-06-24 07:09
I think you are misinterpreting what you are seeing. time.mktime returns
seconds since the Epoch, in UTC, when passed broken-down local time. So
that the result is the same as time.time() doesn't mean that time.time()
returns "local unix seconds" (there is no such thing), but it means that
both time.time() and time.mktime() return seconds since the Epoch, in UTC.

Closing as invalid.
History
Date User Action Args
2022-04-11 14:56:35adminsetgithub: 47435
2008-06-24 07:09:39loewissetstatus: open -> closed
resolution: not a bug
messages: + msg68671
2008-06-24 06:51:50cgrohmannsetmessages: + msg68668
2008-06-24 06:14:54loewissetnosy: + loewis
messages: + msg68667
2008-06-24 05:53:03cgrohmanncreate