annotate Doc/libtime.tex @ 5817:48b94de85bf3 legacy-trunk

Extensive changes by AMK.
author Guido van Rossum <guido@python.org>
date Thu, 17 Jul 1997 16:29:42 +0000
parents e27fa2a3f526
children 3468ea8645ca
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
4729
e27fa2a3f526 (libtime.tex): Merged in changes from Tamito Kajiyama.
Fred Drake <fdrake@acm.org>
parents: 4695
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.
4729
e27fa2a3f526 (libtime.tex): Merged in changes from Tamito Kajiyama.
Fred Drake <fdrake@acm.org>
parents: 4695
diff changeset
32 E.g.\ on most \UNIX{} systems, the clock ``ticks'' only 50 or 100 times a
2576
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
4695
f12b1d4d6a9b Added remark about time() and sleep()'s subsecond precision.
Guido van Rossum <guido@python.org>
parents: 3859
diff changeset
36 On the other hand, the precision of \code{time()} and \code{sleep()}
4729
e27fa2a3f526 (libtime.tex): Merged in changes from Tamito Kajiyama.
Fred Drake <fdrake@acm.org>
parents: 4695
diff changeset
37 is better than their \UNIX{} equivalents: times are expressed as floating
4695
f12b1d4d6a9b Added remark about time() and sleep()'s subsecond precision.
Guido van Rossum <guido@python.org>
parents: 3859
diff changeset
38 point numbers, \code{time()} returns the most accurate time available
4729
e27fa2a3f526 (libtime.tex): Merged in changes from Tamito Kajiyama.
Fred Drake <fdrake@acm.org>
parents: 4695
diff changeset
39 (using \UNIX{} \code{gettimeofday()} where available), and \code{sleep()}
e27fa2a3f526 (libtime.tex): Merged in changes from Tamito Kajiyama.
Fred Drake <fdrake@acm.org>
parents: 4695
diff changeset
40 will accept a time with a nonzero fraction (\UNIX{} \code{select()} is
4695
f12b1d4d6a9b Added remark about time() and sleep()'s subsecond precision.
Guido van Rossum <guido@python.org>
parents: 3859
diff changeset
41 used to implement this, where available).
f12b1d4d6a9b Added remark about time() and sleep()'s subsecond precision.
Guido van Rossum <guido@python.org>
parents: 3859
diff changeset
42
f12b1d4d6a9b Added remark about time() and sleep()'s subsecond precision.
Guido van Rossum <guido@python.org>
parents: 3859
diff changeset
43 \item
3859
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
44 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
45 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
46 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
47 (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
48 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
49 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
50 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
51 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
52 \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
53 state to be filled in.
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
54
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
55
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
56 \end{itemize}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
57
2576
f47bc5554418 mass changes; fix titles; add examples; correct typos; clarifications;
Guido van Rossum <guido@python.org>
parents: 2491
diff changeset
58 The module defines the following functions and data items:
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
59
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
60 \renewcommand{\indexsubitem}{(in module time)}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
61
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
62 \begin{datadesc}{altzone}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
63 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
64 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
65 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
66 Only use this if \code{daylight} is nonzero.
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
67 \end{datadesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
68
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
69 \begin{funcdesc}{asctime}{tuple}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
70 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
71 \code{localtime()} to a 24-character string of the following form:
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
72 \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
73 the same name, there is no trailing newline.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
74 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
75
1807
782509813d57 * Doc/libtime.tex: get rid of references to millitime() and
Guido van Rossum <guido@python.org>
parents: 1767
diff changeset
76 \begin{funcdesc}{clock}{}
782509813d57 * Doc/libtime.tex: get rid of references to millitime() and
Guido van Rossum <guido@python.org>
parents: 1767
diff changeset
77 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
78 seconds. The precision, and in fact the very definiton of the meaning
4695
f12b1d4d6a9b Added remark about time() and sleep()'s subsecond precision.
Guido van Rossum <guido@python.org>
parents: 3859
diff changeset
79 of ``CPU time'', depends on that of the C function of the same name,
f12b1d4d6a9b Added remark about time() and sleep()'s subsecond precision.
Guido van Rossum <guido@python.org>
parents: 3859
diff changeset
80 but in any case, this is the function to use for benchmarking Python
f12b1d4d6a9b Added remark about time() and sleep()'s subsecond precision.
Guido van Rossum <guido@python.org>
parents: 3859
diff changeset
81 or timing algorithms.
1807
782509813d57 * Doc/libtime.tex: get rid of references to millitime() and
Guido van Rossum <guido@python.org>
parents: 1767
diff changeset
82 \end{funcdesc}
782509813d57 * Doc/libtime.tex: get rid of references to millitime() and
Guido van Rossum <guido@python.org>
parents: 1767
diff changeset
83
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
84 \begin{funcdesc}{ctime}{secs}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
85 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
86 representing local time. \code{ctime(t)} is equivalent to
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
87 \code{asctime(localtime(t))}.
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{datadesc}{daylight}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
91 Nonzero if a DST timezone is defined.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
92 \end{datadesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
93
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
94 \begin{funcdesc}{gmtime}{secs}
3859
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
95 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
96 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
97 ignored.
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
98 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
99
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
100 \begin{funcdesc}{localtime}{secs}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
101 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
102 to 1 when DST applies to the given time.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
103 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
104
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
105 \begin{funcdesc}{mktime}{tuple}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
106 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
107 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
108 it is unknown) which expresses the time
4729
e27fa2a3f526 (libtime.tex): Merged in changes from Tamito Kajiyama.
Fred Drake <fdrake@acm.org>
parents: 4695
diff changeset
109 in \emph{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
110 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
111 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
112 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
113
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
114 \begin{funcdesc}{sleep}{secs}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
115 Suspend execution for the given number of seconds. The argument may
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
116 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
117 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
118
3085
a7c97c437191 added strftime
Guido van Rossum <guido@python.org>
parents: 2576
diff changeset
119 \begin{funcdesc}{strftime}{format, tuple}
a7c97c437191 added strftime
Guido van Rossum <guido@python.org>
parents: 2576
diff changeset
120 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
121 \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
122
4729
e27fa2a3f526 (libtime.tex): Merged in changes from Tamito Kajiyama.
Fred Drake <fdrake@acm.org>
parents: 4695
diff changeset
123 The following directives, shown without the optional field width and
e27fa2a3f526 (libtime.tex): Merged in changes from Tamito Kajiyama.
Fred Drake <fdrake@acm.org>
parents: 4695
diff changeset
124 precision specification, are replaced by the indicated characters:
3859
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
125
4729
e27fa2a3f526 (libtime.tex): Merged in changes from Tamito Kajiyama.
Fred Drake <fdrake@acm.org>
parents: 4695
diff changeset
126 \begin{tableii}{|c|p{24em}|}{code}{Directive}{Meaning}
e27fa2a3f526 (libtime.tex): Merged in changes from Tamito Kajiyama.
Fred Drake <fdrake@acm.org>
parents: 4695
diff changeset
127 \lineii{\%a}{Locale's abbreviated weekday name.}
e27fa2a3f526 (libtime.tex): Merged in changes from Tamito Kajiyama.
Fred Drake <fdrake@acm.org>
parents: 4695
diff changeset
128 \lineii{\%A}{Locale's full weekday name.}
e27fa2a3f526 (libtime.tex): Merged in changes from Tamito Kajiyama.
Fred Drake <fdrake@acm.org>
parents: 4695
diff changeset
129 \lineii{\%b}{Locale's abbreviated month name.}
e27fa2a3f526 (libtime.tex): Merged in changes from Tamito Kajiyama.
Fred Drake <fdrake@acm.org>
parents: 4695
diff changeset
130 \lineii{\%B}{Locale's full month name.}
e27fa2a3f526 (libtime.tex): Merged in changes from Tamito Kajiyama.
Fred Drake <fdrake@acm.org>
parents: 4695
diff changeset
131 \lineii{\%c}{Locale's appropriate date and time representation.}
e27fa2a3f526 (libtime.tex): Merged in changes from Tamito Kajiyama.
Fred Drake <fdrake@acm.org>
parents: 4695
diff changeset
132 \lineii{\%d}{Day of the month as a decimal number [01,31].}
e27fa2a3f526 (libtime.tex): Merged in changes from Tamito Kajiyama.
Fred Drake <fdrake@acm.org>
parents: 4695
diff changeset
133 \lineii{\%H}{Hour (24-hour clock) as a decimal number [00,23].}
e27fa2a3f526 (libtime.tex): Merged in changes from Tamito Kajiyama.
Fred Drake <fdrake@acm.org>
parents: 4695
diff changeset
134 \lineii{\%I}{Hour (12-hour clock) as a decimal number [01,12].}
e27fa2a3f526 (libtime.tex): Merged in changes from Tamito Kajiyama.
Fred Drake <fdrake@acm.org>
parents: 4695
diff changeset
135 \lineii{\%j}{Day of the year as a decimal number [001,366].}
e27fa2a3f526 (libtime.tex): Merged in changes from Tamito Kajiyama.
Fred Drake <fdrake@acm.org>
parents: 4695
diff changeset
136 \lineii{\%m}{Month as a decimal number [01,12].}
e27fa2a3f526 (libtime.tex): Merged in changes from Tamito Kajiyama.
Fred Drake <fdrake@acm.org>
parents: 4695
diff changeset
137 \lineii{\%M}{Minute as a decimal number [00,59].}
e27fa2a3f526 (libtime.tex): Merged in changes from Tamito Kajiyama.
Fred Drake <fdrake@acm.org>
parents: 4695
diff changeset
138 \lineii{\%p}{Locale's equivalent of either AM or PM.}
e27fa2a3f526 (libtime.tex): Merged in changes from Tamito Kajiyama.
Fred Drake <fdrake@acm.org>
parents: 4695
diff changeset
139 \lineii{\%S}{Second as a decimal number [00,61].}
e27fa2a3f526 (libtime.tex): Merged in changes from Tamito Kajiyama.
Fred Drake <fdrake@acm.org>
parents: 4695
diff changeset
140 \lineii{\%U}{Week number of the year (Sunday as the first day of the
e27fa2a3f526 (libtime.tex): Merged in changes from Tamito Kajiyama.
Fred Drake <fdrake@acm.org>
parents: 4695
diff changeset
141 week) as a decimal number [00,53]. All days in a new year
e27fa2a3f526 (libtime.tex): Merged in changes from Tamito Kajiyama.
Fred Drake <fdrake@acm.org>
parents: 4695
diff changeset
142 preceding the first Sunday are considered to be in week 0.}
e27fa2a3f526 (libtime.tex): Merged in changes from Tamito Kajiyama.
Fred Drake <fdrake@acm.org>
parents: 4695
diff changeset
143 \lineii{\%w}{Weekday as a decimal number [0(Sunday),6].}
e27fa2a3f526 (libtime.tex): Merged in changes from Tamito Kajiyama.
Fred Drake <fdrake@acm.org>
parents: 4695
diff changeset
144 \lineii{\%W}{Week number of the year (Monday as the first day of the
e27fa2a3f526 (libtime.tex): Merged in changes from Tamito Kajiyama.
Fred Drake <fdrake@acm.org>
parents: 4695
diff changeset
145 week) as a decimal number [00,53]. All days in a new year
e27fa2a3f526 (libtime.tex): Merged in changes from Tamito Kajiyama.
Fred Drake <fdrake@acm.org>
parents: 4695
diff changeset
146 preceding the first Sunday are considered to be in week 0.}
e27fa2a3f526 (libtime.tex): Merged in changes from Tamito Kajiyama.
Fred Drake <fdrake@acm.org>
parents: 4695
diff changeset
147 \lineii{\%x}{Locale's appropriate date representation.}
e27fa2a3f526 (libtime.tex): Merged in changes from Tamito Kajiyama.
Fred Drake <fdrake@acm.org>
parents: 4695
diff changeset
148 \lineii{\%X}{Locale's appropriate time representation.}
e27fa2a3f526 (libtime.tex): Merged in changes from Tamito Kajiyama.
Fred Drake <fdrake@acm.org>
parents: 4695
diff changeset
149 \lineii{\%y}{Year without century as a decimal number [00,99].}
e27fa2a3f526 (libtime.tex): Merged in changes from Tamito Kajiyama.
Fred Drake <fdrake@acm.org>
parents: 4695
diff changeset
150 \lineii{\%Y}{Year with century as a decimal number.}
e27fa2a3f526 (libtime.tex): Merged in changes from Tamito Kajiyama.
Fred Drake <fdrake@acm.org>
parents: 4695
diff changeset
151 \lineii{\%Z}{Time zone name (or by no characters if no time zone exists).}
e27fa2a3f526 (libtime.tex): Merged in changes from Tamito Kajiyama.
Fred Drake <fdrake@acm.org>
parents: 4695
diff changeset
152 \lineii{\%\%}{\%}
e27fa2a3f526 (libtime.tex): Merged in changes from Tamito Kajiyama.
Fred Drake <fdrake@acm.org>
parents: 4695
diff changeset
153 \end{tableii}
3859
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
154
4729
e27fa2a3f526 (libtime.tex): Merged in changes from Tamito Kajiyama.
Fred Drake <fdrake@acm.org>
parents: 4695
diff changeset
155 Additional directives may be supported on certain platforms, but
e27fa2a3f526 (libtime.tex): Merged in changes from Tamito Kajiyama.
Fred Drake <fdrake@acm.org>
parents: 4695
diff changeset
156 only the ones listed here have a meaning standardized by ANSI C.
3859
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
157
4729
e27fa2a3f526 (libtime.tex): Merged in changes from Tamito Kajiyama.
Fred Drake <fdrake@acm.org>
parents: 4695
diff changeset
158 On some platforms, an optional field width and precision
e27fa2a3f526 (libtime.tex): Merged in changes from Tamito Kajiyama.
Fred Drake <fdrake@acm.org>
parents: 4695
diff changeset
159 specification can immediately follow the initial \% of a
e27fa2a3f526 (libtime.tex): Merged in changes from Tamito Kajiyama.
Fred Drake <fdrake@acm.org>
parents: 4695
diff changeset
160 directive in the following order; this is also not portable.
e27fa2a3f526 (libtime.tex): Merged in changes from Tamito Kajiyama.
Fred Drake <fdrake@acm.org>
parents: 4695
diff changeset
161 The field width is normally 2 except for \%j where it is 3.
3859
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
162
3085
a7c97c437191 added strftime
Guido van Rossum <guido@python.org>
parents: 2576
diff changeset
163 \end{funcdesc}
a7c97c437191 added strftime
Guido van Rossum <guido@python.org>
parents: 2576
diff changeset
164
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
165 \begin{funcdesc}{time}{}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
166 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
167 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
168 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
169 precision than 1 second.
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
170 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
171
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
172 \begin{datadesc}{timezone}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
173 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
174 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
175 zero in the UK).
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
176 \end{datadesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
177
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
178 \begin{datadesc}{tzname}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
179 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
180 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
181 timezone is defined, the second string should not be used.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
182 \end{datadesc}
3859
0853166f0d69 Moved description of mktime 9-tuple to top.
Guido van Rossum <guido@python.org>
parents: 3714
diff changeset
183