Skip to content

Commit 12deda7

Browse files
authored
gh-101100: Fix sphinx warnings in library/time.rst (#110862)
1 parent 5965891 commit 12deda7

File tree

2 files changed

+60
-34
lines changed

2 files changed

+60
-34
lines changed

Doc/library/time.rst

Lines changed: 60 additions & 33 deletions
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:
@@ -501,6 +503,8 @@ Functions
501503
When used with the :func:`strptime` function, the ``%p`` directive only affects
502504
the output hour field if the ``%I`` directive is used to parse the hour.
503505

506+
.. _leap-second:
507+
504508
(2)
505509
The range really is ``0`` to ``61``; value ``60`` is valid in
506510
timestamps representing `leap seconds`_ and value ``61`` is supported
@@ -571,32 +575,55 @@ Functions
571575
tuple` interface: values can be accessed by index and by attribute name. The
572576
following values are present:
573577

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

601628
Note that unlike the C structure, the month value is a range of [1, 12], not
602629
[0, 11].
@@ -917,8 +944,8 @@ Timezone Constants
917944
For the above Timezone constants (:data:`altzone`, :data:`daylight`, :data:`timezone`,
918945
and :data:`tzname`), the value is determined by the timezone rules in effect
919946
at module load time or the last time :func:`tzset` is called and may be incorrect
920-
for times in the past. It is recommended to use the :attr:`tm_gmtoff` and
921-
:attr:`tm_zone` results from :func:`localtime` to obtain timezone information.
947+
for times in the past. It is recommended to use the :attr:`~struct_time.tm_gmtoff` and
948+
:attr:`~struct_time.tm_zone` results from :func:`localtime` to obtain timezone information.
922949

923950

924951
.. seealso::

Doc/tools/.nitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ Doc/library/tarfile.rst
117117
Doc/library/tempfile.rst
118118
Doc/library/termios.rst
119119
Doc/library/test.rst
120-
Doc/library/time.rst
121120
Doc/library/tkinter.rst
122121
Doc/library/tkinter.scrolledtext.rst
123122
Doc/library/tkinter.ttk.rst

0 commit comments

Comments
 (0)