Skip to content

Commit 744f752

Browse files
[3.12] gh-101100: Fix sphinx warnings in library/time.rst (GH-110862) (#110877)
gh-101100: Fix sphinx warnings in `library/time.rst` (GH-110862) (cherry picked from commit 12deda7) Co-authored-by: Nikita Sobolev <[email protected]>
1 parent 0c56c05 commit 744f752

File tree

2 files changed

+60
-34
lines changed

2 files changed

+60
-34
lines changed

Doc/library/time.rst

+60-33
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ An explanation of some terminology and conventions is in order.
7171
* On the other hand, the precision of :func:`.time` and :func:`sleep` is better
7272
than their Unix equivalents: times are expressed as floating point numbers,
7373
:func:`.time` returns the most accurate time available (using Unix
74-
:c:func:`gettimeofday` where available), and :func:`sleep` will accept a time
75-
with a nonzero fraction (Unix :c:func:`select` is used to implement this, where
74+
:c:func:`!gettimeofday` where available), and :func:`sleep` will accept a time
75+
with a nonzero fraction (Unix :c:func:`!select` is used to implement this, where
7676
available).
7777

7878
* The time value as returned by :func:`gmtime`, :func:`localtime`, and
@@ -84,12 +84,14 @@ An explanation of some terminology and conventions is in order.
8484
See :class:`struct_time` for a description of these objects.
8585

8686
.. versionchanged:: 3.3
87-
The :class:`struct_time` type was extended to provide the :attr:`tm_gmtoff`
88-
and :attr:`tm_zone` attributes when platform supports corresponding
87+
The :class:`struct_time` type was extended to provide
88+
the :attr:`~struct_time.tm_gmtoff` and :attr:`~struct_time.tm_zone`
89+
attributes when platform supports corresponding
8990
``struct tm`` members.
9091

9192
.. versionchanged:: 3.6
92-
The :class:`struct_time` attributes :attr:`tm_gmtoff` and :attr:`tm_zone`
93+
The :class:`struct_time` attributes
94+
:attr:`~struct_time.tm_gmtoff` and :attr:`~struct_time.tm_zone`
9395
are now available on all platforms.
9496

9597
* Use the following functions to convert between time representations:
@@ -496,6 +498,8 @@ Functions
496498
When used with the :func:`strptime` function, the ``%p`` directive only affects
497499
the output hour field if the ``%I`` directive is used to parse the hour.
498500

501+
.. _leap-second:
502+
499503
(2)
500504
The range really is ``0`` to ``61``; value ``60`` is valid in
501505
timestamps representing `leap seconds`_ and value ``61`` is supported
@@ -566,32 +570,55 @@ Functions
566570
tuple` interface: values can be accessed by index and by attribute name. The
567571
following values are present:
568572

569-
+-------+-------------------+---------------------------------+
570-
| Index | Attribute | Values |
571-
+=======+===================+=================================+
572-
| 0 | :attr:`tm_year` | (for example, 1993) |
573-
+-------+-------------------+---------------------------------+
574-
| 1 | :attr:`tm_mon` | range [1, 12] |
575-
+-------+-------------------+---------------------------------+
576-
| 2 | :attr:`tm_mday` | range [1, 31] |
577-
+-------+-------------------+---------------------------------+
578-
| 3 | :attr:`tm_hour` | range [0, 23] |
579-
+-------+-------------------+---------------------------------+
580-
| 4 | :attr:`tm_min` | range [0, 59] |
581-
+-------+-------------------+---------------------------------+
582-
| 5 | :attr:`tm_sec` | range [0, 61]; see **(2)** in |
583-
| | | :func:`strftime` description |
584-
+-------+-------------------+---------------------------------+
585-
| 6 | :attr:`tm_wday` | range [0, 6], Monday is 0 |
586-
+-------+-------------------+---------------------------------+
587-
| 7 | :attr:`tm_yday` | range [1, 366] |
588-
+-------+-------------------+---------------------------------+
589-
| 8 | :attr:`tm_isdst` | 0, 1 or -1; see below |
590-
+-------+-------------------+---------------------------------+
591-
| N/A | :attr:`tm_zone` | abbreviation of timezone name |
592-
+-------+-------------------+---------------------------------+
593-
| N/A | :attr:`tm_gmtoff` | offset east of UTC in seconds |
594-
+-------+-------------------+---------------------------------+
573+
.. list-table::
574+
575+
* - Index
576+
- Attribute
577+
- Values
578+
579+
* - 0
580+
- .. attribute:: tm_year
581+
- (for example, 1993)
582+
583+
* - 1
584+
- .. attribute:: tm_mon
585+
- range [1, 12]
586+
587+
* - 2
588+
- .. attribute:: tm_day
589+
- range [1, 31]
590+
591+
* - 3
592+
- .. attribute:: tm_hour
593+
- range [0, 23]
594+
595+
* - 4
596+
- .. attribute:: tm_min
597+
- range [0, 59]
598+
599+
* - 5
600+
- .. attribute:: tm_sec
601+
- range [0, 61]; see :ref:`Note (2) <leap-second>` in :func:`strftime`
602+
603+
* - 6
604+
- .. attribute:: tm_wday
605+
- range [0, 6]; Monday is 0
606+
607+
* - 7
608+
- .. attribute:: tm_yday
609+
- range [1, 366]
610+
611+
* - 8
612+
- .. attribute:: tm_isdst
613+
- 0, 1 or -1; see below
614+
615+
* - N/A
616+
- .. attribute:: tm_zone
617+
- abbreviation of timezone name
618+
619+
* - N/A
620+
- .. attribute:: tm_gmtoff
621+
- offset east of UTC in seconds
595622

596623
Note that unlike the C structure, the month value is a range of [1, 12], not
597624
[0, 11].
@@ -912,8 +939,8 @@ Timezone Constants
912939
For the above Timezone constants (:data:`altzone`, :data:`daylight`, :data:`timezone`,
913940
and :data:`tzname`), the value is determined by the timezone rules in effect
914941
at module load time or the last time :func:`tzset` is called and may be incorrect
915-
for times in the past. It is recommended to use the :attr:`tm_gmtoff` and
916-
:attr:`tm_zone` results from :func:`localtime` to obtain timezone information.
942+
for times in the past. It is recommended to use the :attr:`~struct_time.tm_gmtoff` and
943+
:attr:`~struct_time.tm_zone` results from :func:`localtime` to obtain timezone information.
917944

918945

919946
.. seealso::

Doc/tools/.nitignore

-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ Doc/library/telnetlib.rst
131131
Doc/library/tempfile.rst
132132
Doc/library/termios.rst
133133
Doc/library/test.rst
134-
Doc/library/time.rst
135134
Doc/library/tkinter.rst
136135
Doc/library/tkinter.scrolledtext.rst
137136
Doc/library/tkinter.tix.rst

0 commit comments

Comments
 (0)