annotate Doc/libtime.tex @ 4566:6403c94de50d legacy-trunk

Added safeguard against failure in __del__.
author Guido van Rossum <guido@python.org>
date Wed, 27 Nov 1996 19:39:58 +0000
parents 0853166f0d69
children f12b1d4d6a9b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
1 \section{Built-in Module \sectcode{time}}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
2
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
3 \bimodindex{time}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
4 This module provides various time-related functions.
1807
782509813d57 * Doc/libtime.tex: get rid of references to millitime() and
Guido van Rossum <guido@python.org>
parents: 1767
diff changeset
5 It is always available.
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
6
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
7 An explanation of some terminology and conventions is in order.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
8
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
9 \begin{itemize}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
10
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
11 \item
1767
907605320a5f Lots of small corrections by Andrew Kuchling (plus all new rotor docs)
Guido van Rossum <guido@python.org>
parents: 1471
diff changeset
12 The ``epoch'' is the point where the time starts. On January 1st of that
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
13 year, at 0 hours, the ``time since the epoch'' is zero. For UNIX, the
2576
f47bc5554418 mass changes; fix titles; add examples; correct typos; clarifications;
Guido van Rossum <guido@python.org>
parents: 2491
diff changeset
14 epoch is 1970. To find out what the epoch is, look at \code{gmtime(0)}.
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
15
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
16 \item
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
17 UTC is Coordinated Universal Time (formerly known as Greenwich Mean
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
18 Time). The acronym UTC is not a mistake but a compromise between
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
19 English and French.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
20
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
21 \item
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
22 DST is Daylight Saving Time, an adjustment of the timezone by
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
23 (usually) one hour during part of the year. DST rules are magic
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
24 (determined by local law) and can change from year to year. The C
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
25 library has a table containing the local rules (often it is read from
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
26 a system file for flexibility) and is the only source of True Wisdom
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
27 in this respect.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
28
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
29 \item
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
30 The precision of the various real-time functions may be less than
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
31 suggested by the units in which their value or argument is expressed.
2576
f47bc5554418 mass changes; fix titles; add examples; correct typos; clarifications;
Guido van Rossum <guido@python.org>
parents: 2491
diff changeset
32 E.g.\ on most UNIX systems, the clock ``ticks'' only 50 or 100 times a
f47bc5554418 mass changes; fix titles; add examples; correct typos; clarifications;
Guido van Rossum <guido@python.org>
parents: 2491
diff changeset
33 second, and on the Mac, times are only accurate to whole seconds.
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
34
3859
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
35 \item
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
36 The time tuple as returned by \code{gmtime()} and \code{localtime()},
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
37 or as accpted by \code{mktime()} is a tuple of 9
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
38 integers: year (e.g.\ 1993), month (1--12), day (1--31), hour
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
39 (0--23), minute (0--59), second (0--59), weekday (0--6, monday is 0),
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
40 Julian day (1--366) and daylight savings flag (-1, 0 or 1).
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
41 Note that unlike the C structure, the month value is a range of 1-12, not
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
42 0-11. A year value of $<$ 100 will typically be silently converted to
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
43 1900 $+$ year value. A -1 argument as daylight savings flag, passed to
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
44 \code{mktime()} will usually result in the correct daylight savings
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
45 state to be filled in.
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
46
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
47
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
48 \end{itemize}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
49
2576
f47bc5554418 mass changes; fix titles; add examples; correct typos; clarifications;
Guido van Rossum <guido@python.org>
parents: 2491
diff changeset
50 The module defines the following functions and data items:
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
51
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
52 \renewcommand{\indexsubitem}{(in module time)}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
53
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
54 \begin{datadesc}{altzone}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
55 The offset of the local DST timezone, in seconds west of the 0th
2576
f47bc5554418 mass changes; fix titles; add examples; correct typos; clarifications;
Guido van Rossum <guido@python.org>
parents: 2491
diff changeset
56 meridian, if one is defined. Negative if the local DST timezone is
f47bc5554418 mass changes; fix titles; add examples; correct typos; clarifications;
Guido van Rossum <guido@python.org>
parents: 2491
diff changeset
57 east of the 0th meridian (as in Western Europe, including the UK).
f47bc5554418 mass changes; fix titles; add examples; correct typos; clarifications;
Guido van Rossum <guido@python.org>
parents: 2491
diff changeset
58 Only use this if \code{daylight} is nonzero.
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
59 \end{datadesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
60
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
61 \begin{funcdesc}{asctime}{tuple}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
62 Convert a tuple representing a time as returned by \code{gmtime()} or
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
63 \code{localtime()} to a 24-character string of the following form:
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
64 \code{'Sun Jun 20 23:21:05 1993'}. Note: unlike the C function of
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
65 the same name, there is no trailing newline.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
66 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
67
1807
782509813d57 * Doc/libtime.tex: get rid of references to millitime() and
Guido van Rossum <guido@python.org>
parents: 1767
diff changeset
68 \begin{funcdesc}{clock}{}
782509813d57 * Doc/libtime.tex: get rid of references to millitime() and
Guido van Rossum <guido@python.org>
parents: 1767
diff changeset
69 Return the current CPU time as a floating point number expressed in
2576
f47bc5554418 mass changes; fix titles; add examples; correct typos; clarifications;
Guido van Rossum <guido@python.org>
parents: 2491
diff changeset
70 seconds. The precision, and in fact the very definiton of the meaning
f47bc5554418 mass changes; fix titles; add examples; correct typos; clarifications;
Guido van Rossum <guido@python.org>
parents: 2491
diff changeset
71 of ``CPU time'', depends on that of the C function of the same name.
1807
782509813d57 * Doc/libtime.tex: get rid of references to millitime() and
Guido van Rossum <guido@python.org>
parents: 1767
diff changeset
72 \end{funcdesc}
782509813d57 * Doc/libtime.tex: get rid of references to millitime() and
Guido van Rossum <guido@python.org>
parents: 1767
diff changeset
73
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
74 \begin{funcdesc}{ctime}{secs}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
75 Convert a time expressed in seconds since the epoch to a string
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
76 representing local time. \code{ctime(t)} is equivalent to
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
77 \code{asctime(localtime(t))}.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
78 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
79
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
80 \begin{datadesc}{daylight}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
81 Nonzero if a DST timezone is defined.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
82 \end{datadesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
83
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
84 \begin{funcdesc}{gmtime}{secs}
3859
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
85 Convert a time expressed in seconds since the epoch to a time tuple
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
86 in UTC in which the dst flag is always zero. Fractions of a second are
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
87 ignored.
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
88 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
89
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
90 \begin{funcdesc}{localtime}{secs}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
91 Like \code{gmtime} but converts to local time. The dst flag is set
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
92 to 1 when DST applies to the given time.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
93 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
94
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
95 \begin{funcdesc}{mktime}{tuple}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
96 This is the inverse function of \code{localtime}. Its argument is the
3859
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
97 full 9-tuple (since the dst flag is needed --- pass -1 as the dst flag if
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
98 it is unknown) which expresses the time
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
99 in \em{local} time, not UTC. It returns a floating
3714
c120a483d590 mktime returns a float now.
Guido van Rossum <guido@python.org>
parents: 3380
diff changeset
100 point number, for compatibility with \code{time.time()}. If the input
c120a483d590 mktime returns a float now.
Guido van Rossum <guido@python.org>
parents: 3380
diff changeset
101 value can't be represented as a valid time, OverflowError is raised.
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
102 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
103
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
104 \begin{funcdesc}{sleep}{secs}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
105 Suspend execution for the given number of seconds. The argument may
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
106 be a floating point number to indicate a more precise sleep time.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
107 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
108
3085
a7c97c437191 added strftime
Guido van Rossum <guido@python.org>
parents: 2576
diff changeset
109 \begin{funcdesc}{strftime}{format, tuple}
a7c97c437191 added strftime
Guido van Rossum <guido@python.org>
parents: 2576
diff changeset
110 Convert a tuple representing a time as returned by \code{gmtime()} or
a7c97c437191 added strftime
Guido van Rossum <guido@python.org>
parents: 2576
diff changeset
111 \code{localtime()} to a string as specified by the format argument.
3859
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
112
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
113 The following directives, shown without the optional field width and
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
114 precision specification, are replaced by the indicated characters:
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
115
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
116 \begin{tabular}{lp{25em}}
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
117 \%a & Locale's abbreviated weekday name. \\
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
118 \%A & Locale's full weekday name. \\
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
119 \%b & Locale's abbreviated month name. \\
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
120 \%B & Locale's full month name. \\
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
121 \%c & Locale's appropriate date and time representation. \\
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
122 \%d & Day of the month as a decimal number [01,31]. \\
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
123 \%E & Locale's combined Emperor/Era name and year. \\
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
124 \%H & Hour (24-hour clock) as a decimal number [00,23]. \\
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
125 \%I & Hour (12-hour clock) as a decimal number [01,12]. \\
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
126 \%j & Day of the year as a decimal number [001,366]. \\
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
127 \%m & Month as a decimal number [01,12]. \\
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
128 \%M & Minute as a decimal number [00,59]. \\
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
129 \%n & New-line character. \\
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
130 \%N & Locale's Emperor/Era name. \\
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
131 \%o & Locale's Emperor/Era year. \\
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
132 \%p & Locale's equivalent of either AM or PM. \\
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
133 \%S & Second as a decimal number [00,61]. \\
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
134 \%t & Tab character. \\
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
135 \%U & Week number of the year (Sunday as the first day of the
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
136 week) as a decimal number [00,53]. All days in a new
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
137 year preceding the first Sunday are considered to be in
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
138 week 0. \\
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
139 \%w & Weekday as a decimal number [0(Sunday),6]. \\
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
140 \%W & Week number of the year (Monday as the first day of the
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
141 week) as a decimal number [00,53]. All days in a new
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
142 year preceding the first Sunday are considered to be in
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
143 week 0. \\
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
144 \%x & Locale's appropriate date representation. \\
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
145 \%X & Locale's appropriate time representation. \\
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
146 \%y & Year without century as a decimal number [00,99]. \\
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
147 \%Y & Year with century as a decimal number. \\
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
148 \%Z & Time zone name (or by no characters if no time zone
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
149 exists). \\
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
150 \%\% & \% \\
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
151 \end{tabular}
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
152
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
153 An optional field width and precision specification can immediately
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
154 follow the initial \% of a directive in the following order: \\
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
155
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
156 \begin{tabular}{lp{25em}}
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
157 [-|0]w & the decimal digit string w specifies a minimum field
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
158 width in which the result of the conversion is right-
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
159 or left-justified. It is right-justified (with space
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
160 padding) by default. If the optional flag `-' is
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
161 specified, it is left-justified with space padding on
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
162 the right. If the optional flag `0' is specified, it
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
163 is right-justified and padded with zeros on the left. \\
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
164 .p & the decimal digit string p specifies the minimum number
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
165 of digits to appear for the d, H, I, j, m, M, o, S, U,
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
166 w, W, y and Y directives, and the maximum number of
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
167 characters to be used from the a, A, b, B, c, D, E, F,
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
168 h, n, N, p, r, t, T, x, X, z, Z, and % directives. In
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
169 the first case, if a directive supplies fewer digits
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
170 than specified by the precision, it will be expanded
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
171 with leading zeros. In the second case, if a directive
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
172 supplies more characters than specified by the
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
173 precision, excess characters will truncated on the
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
174 right.
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
175 \end{tabular}
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
176
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
177 If no field width or precision is specified for a d, H, I, m, M, S, U,
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
178 W, y, or j directive, a default of .2 is used for all but j for which
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
179 .3 is used.
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
180
3085
a7c97c437191 added strftime
Guido van Rossum <guido@python.org>
parents: 2576
diff changeset
181 \end{funcdesc}
a7c97c437191 added strftime
Guido van Rossum <guido@python.org>
parents: 2576
diff changeset
182
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
183 \begin{funcdesc}{time}{}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
184 Return the time as a floating point number expressed in seconds since
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
185 the epoch, in UTC. Note that even though the time is always returned
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
186 as a floating point number, not all systems provide time with a better
1807
782509813d57 * Doc/libtime.tex: get rid of references to millitime() and
Guido van Rossum <guido@python.org>
parents: 1767
diff changeset
187 precision than 1 second.
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
188 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
189
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
190 \begin{datadesc}{timezone}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
191 The offset of the local (non-DST) timezone, in seconds west of the 0th
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
192 meridian (i.e. negative in most of Western Europe, positive in the US,
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
193 zero in the UK).
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
194 \end{datadesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
195
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
196 \begin{datadesc}{tzname}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
197 A tuple of two strings: the first is the name of the local non-DST
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
198 timezone, the second is the name of the local DST timezone. If no DST
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
199 timezone is defined, the second string should not be used.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
200 \end{datadesc}
3859
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
201