@@ -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:
@@ -496,6 +498,8 @@ Functions
496
498
When used with the :func: `strptime ` function, the ``%p `` directive only affects
497
499
the output hour field if the ``%I `` directive is used to parse the hour.
498
500
501
+ .. _leap-second :
502
+
499
503
(2)
500
504
The range really is ``0 `` to ``61 ``; value ``60 `` is valid in
501
505
timestamps representing `leap seconds `_ and value ``61 `` is supported
@@ -566,32 +570,55 @@ Functions
566
570
tuple ` interface: values can be accessed by index and by attribute name. The
567
571
following values are present:
568
572
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
595
622
596
623
Note that unlike the C structure, the month value is a range of [1, 12], not
597
624
[0, 11].
@@ -912,8 +939,8 @@ Timezone Constants
912
939
For the above Timezone constants (:data: `altzone `, :data: `daylight `, :data: `timezone `,
913
940
and :data: `tzname `), the value is determined by the timezone rules in effect
914
941
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.
917
944
918
945
919
946
.. seealso ::
0 commit comments