Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bad4607

Browse files
committed
Document struct_time and the field names.
1 parent 4400509 commit bad4607

1 file changed

Lines changed: 25 additions & 14 deletions

File tree

Doc/lib/libtime.tex

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -73,33 +73,38 @@ \section{\module{time} ---
7373
this, where available).
7474

7575
\item
76-
The time tuple as returned by \function{gmtime()},
76+
The time value as returned by \function{gmtime()},
7777
\function{localtime()}, and \function{strptime()}, and accepted by
7878
\function{asctime()}, \function{mktime()} and \function{strftime()},
79-
is a tuple of 9 integers:
80-
81-
\begin{tableiii}{r|l|l}{textrm}{Index}{Field}{Values}
82-
\lineiii{0}{year}{(for example, 1993)}
83-
\lineiii{1}{month}{range [1,12]}
84-
\lineiii{2}{day}{range [1,31]}
85-
\lineiii{3}{hour}{range [0,23]}
86-
\lineiii{4}{minute}{range [0,59]}
87-
\lineiii{5}{second}{range [0,61]; see \strong{(1)} in \function{strftime()} description}
88-
\lineiii{6}{weekday}{range [0,6], Monday is 0}
89-
\lineiii{7}{Julian day}{range [1,366]}
90-
\lineiii{8}{daylight savings flag}{0, 1 or -1; see below}
79+
is a sequence of 9 integers. The return values of \function{gmtime()},
80+
\function{localtime()}, and \function{strptime()} also offer attribute
81+
names for individual fields.
82+
83+
\begin{tableiii}{c|l|l}{textrm}{Index}{Attribute}{Values}
84+
\lineiii{0}{\member{tm_year}}{(for example, 1993)}
85+
\lineiii{1}{\member{tm_mon}}{range [1,12]}
86+
\lineiii{2}{\member{tm_mday}}{range [1,31]}
87+
\lineiii{3}{\member{tm_hour}}{range [0,23]}
88+
\lineiii{4}{\member{tm_min}}{range [0,59]}
89+
\lineiii{5}{\member{tm_sec}}{range [0,61]; see \strong{(1)} in \function{strftime()} description}
90+
\lineiii{6}{\member{tm_wday}}{range [0,6], Monday is 0}
91+
\lineiii{7}{\member{tm_yday}}{range [1,366]}
92+
\lineiii{8}{\member{tm_isdst}}{0, 1 or -1; see below}
9193
\end{tableiii}
9294

9395
Note that unlike the C structure, the month value is a
9496
range of 1-12, not 0-11. A year value will be handled as described
95-
under ``Year 2000 (Y2K) issues'' above. A \code{-1} argument as
97+
under ``Year 2000 (Y2K) issues'' above. A \code{-1} argument as the
9698
daylight savings flag, passed to \function{mktime()} will usually
9799
result in the correct daylight savings state to be filled in.
98100

99101
When a tuple with an incorrect length is passed to a function
100102
expecting a time tuple, or having elements of the wrong type, a
101103
\exception{TypeError} is raised.
102104

105+
\versionchanged[The time value sequence was changed from a tuple to a
106+
specialized type, with the addition of attribute names
107+
for the fields]{2.2}
103108
\end{itemize}
104109

105110
The module defines the following functions and data items:
@@ -285,6 +290,12 @@ \section{\module{time} ---
285290
does not provide sufficient information to constrain the result.
286291
\end{funcdesc}
287292

293+
\begin{datadesc}{struct_time}
294+
The type of the time value sequence returned by \function{gmtime()},
295+
\function{localtime()}, and \function{strptime()}.
296+
\versionadded{2.2}
297+
\end{datadesc}
298+
288299
\begin{funcdesc}{time}{}
289300
Return the time as a floating point number expressed in seconds since
290301
the epoch, in UTC. Note that even though the time is always returned

0 commit comments

Comments
 (0)