Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d387bf7

Browse filesBrowse files
committed
bpo-29026: Minor improvements for time.time doc
1 parent 31ce20b commit d387bf7
Copy full SHA for d387bf7

File tree

1 file changed

+17
-11
lines changed
Filter options

1 file changed

+17
-11
lines changed

‎Doc/library/time.rst

Copy file name to clipboardExpand all lines: Doc/library/time.rst
+17-11Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,23 @@ semantics of these functions varies among platforms.
1717

1818
An explanation of some terminology and conventions is in order.
1919

20+
.. _epoch:
21+
2022
.. index:: single: epoch
2123

2224
* The :dfn:`epoch` is the point where the time starts, and is platform
2325
dependent. For Unix, the epoch is January 1, 1970, 00:00:00 (UTC).
24-
To find out what the epoch is on a given platform, look at ``gmtime(0)``.
26+
To find out what the epoch is on a given platform, look at
27+
``time.gmtime(0)``.
28+
29+
.. _leap seconds: https://en.wikipedia.org/wiki/Leap_second
2530

2631
.. index:: seconds since the epoch
2732

2833
* The term :dfn:`seconds since the epoch` refers to the total number
2934
of elapsed seconds since the epoch, typically excluding
30-
`leap seconds <https://en.wikipedia.org/wiki/Leap_second>`_.
31-
Leap seconds are excluded from this total on all POSIX-compliant platforms.
35+
`leap seconds`_. Leap seconds are excluded from this total on all
36+
POSIX-compliant platforms.
3237

3338
.. index:: single: Year 2038
3439

@@ -579,27 +584,28 @@ The module defines the following functions and data items:
579584

580585
.. function:: time()
581586

582-
Return the time in seconds since the epoch as a floating point
587+
Return the time in seconds since the epoch_ as a floating point
583588
number. The specific date of the epoch and the handling of
584-
`leap seconds <https://en.wikipedia.org/wiki/Leap_second>`_
585-
is platform dependent.
589+
`leap seconds`_ is platform dependent.
586590
On Windows and most Unix systems, the epoch is January 1, 1970,
587591
00:00:00 (UTC) and leap seconds are not counted towards the time
588592
in seconds since the epoch. This is commonly referred to as
589593
`Unix time <https://en.wikipedia.org/wiki/Unix_time>`_.
594+
To find out what the epoch is on a given platform, look at
595+
``time.gmtime(0)``.
590596

591597
Note that even though the time is always returned as a floating point
592598
number, not all systems provide time with a better precision than 1 second.
593599
While this function normally returns non-decreasing values, it can return a
594600
lower value than a previous call if the system clock has been set back
595601
between the two calls.
596602

597-
The number returned by :func:`time` may be converted into a more common
603+
The number returned by :func:`time.time` may be converted into a more common
598604
time format (i.e. year, month, day, hour, etc...) in UTC by passing it to
599-
:func:`gmtime` function or in local time by passing it to the
600-
:func:`localtime` function. In both cases a :class:`struct_time` object
601-
is returned, from which the components of the calendar date may be accessed
602-
as attributes.
605+
:func:`time.gmtime` function or in local time by passing it to the
606+
:func:`time.localtime` function. In both cases a
607+
:class:`time.struct_time` object is returned, from which the components
608+
of the calendar date may be accessed as attributes.
603609

604610
.. data:: timezone
605611

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.