@@ -71,8 +71,8 @@ An explanation of some terminology and conventions is in order.
71
71
* On the other hand, the precision of :func: `.time ` and :func: `sleep ` is better
72
72
than their Unix equivalents: times are expressed as floating point numbers,
73
73
: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
76
76
available).
77
77
78
78
* 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.
84
84
See :class: `struct_time ` for a description of these objects.
85
85
86
86
.. 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
89
90
``struct tm `` members.
90
91
91
92
.. 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 `
93
95
are now available on all platforms.
94
96
95
97
* Use the following functions to convert between time representations:
@@ -501,6 +503,8 @@ Functions
501
503
When used with the :func: `strptime ` function, the ``%p `` directive only affects
502
504
the output hour field if the ``%I `` directive is used to parse the hour.
503
505
506
+ .. _leap-second :
507
+
504
508
(2)
505
509
The range really is ``0 `` to ``61 ``; value ``60 `` is valid in
506
510
timestamps representing `leap seconds `_ and value ``61 `` is supported
@@ -571,32 +575,55 @@ Functions
571
575
tuple ` interface: values can be accessed by index and by attribute name. The
572
576
following values are present:
573
577
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
600
627
601
628
Note that unlike the C structure, the month value is a range of [1, 12], not
602
629
[0, 11].
@@ -917,8 +944,8 @@ Timezone Constants
917
944
For the above Timezone constants (:data: `altzone `, :data: `daylight `, :data: `timezone `,
918
945
and :data: `tzname `), the value is determined by the timezone rules in effect
919
946
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.
922
949
923
950
924
951
.. seealso ::
0 commit comments