Commit 094579e6 authored by Fred Drake's avatar Fred Drake

(libtime.tex): Merged in changes from Tamito Kajiyama.

	(For those watching Python CVS messages:  I checked in all of
	Tamito's other changes, but the mail delivery failed since the
	subject line was too long.  The patch Tamito sent for the
	documentation has been completely merged in.)
parent 4b3f0312
...@@ -10,7 +10,7 @@ An explanation of some terminology and conventions is in order. ...@@ -10,7 +10,7 @@ An explanation of some terminology and conventions is in order.
\item \item
The ``epoch'' is the point where the time starts. On January 1st of that The ``epoch'' is the point where the time starts. On January 1st of that
year, at 0 hours, the ``time since the epoch'' is zero. For UNIX, the year, at 0 hours, the ``time since the epoch'' is zero. For \UNIX{}, the
epoch is 1970. To find out what the epoch is, look at \code{gmtime(0)}. epoch is 1970. To find out what the epoch is, look at \code{gmtime(0)}.
\item \item
...@@ -29,15 +29,15 @@ in this respect. ...@@ -29,15 +29,15 @@ in this respect.
\item \item
The precision of the various real-time functions may be less than The precision of the various real-time functions may be less than
suggested by the units in which their value or argument is expressed. suggested by the units in which their value or argument is expressed.
E.g.\ on most UNIX systems, the clock ``ticks'' only 50 or 100 times a E.g.\ on most \UNIX{} systems, the clock ``ticks'' only 50 or 100 times a
second, and on the Mac, times are only accurate to whole seconds. second, and on the Mac, times are only accurate to whole seconds.
\item \item
On the other hand, the precision of \code{time()} and \code{sleep()} On the other hand, the precision of \code{time()} and \code{sleep()}
is better than their UNIX equivalents: times are expressed as floating is better than their \UNIX{} equivalents: times are expressed as floating
point numbers, \code{time()} returns the most accurate time available point numbers, \code{time()} returns the most accurate time available
(using UNIX \code{gettimeofday()} where available), and \code{sleep()} (using \UNIX{} \code{gettimeofday()} where available), and \code{sleep()}
will accept a time with a nonzero fraction (UNIX \code{select()} is will accept a time with a nonzero fraction (\UNIX{} \code{select()} is
used to implement this, where available). used to implement this, where available).
\item \item
...@@ -106,7 +106,7 @@ to 1 when DST applies to the given time. ...@@ -106,7 +106,7 @@ to 1 when DST applies to the given time.
This is the inverse function of \code{localtime}. Its argument is the This is the inverse function of \code{localtime}. Its argument is the
full 9-tuple (since the dst flag is needed --- pass -1 as the dst flag if full 9-tuple (since the dst flag is needed --- pass -1 as the dst flag if
it is unknown) which expresses the time it is unknown) which expresses the time
in \em{local} time, not UTC. It returns a floating in \emph{local} time, not UTC. It returns a floating
point number, for compatibility with \code{time.time()}. If the input point number, for compatibility with \code{time.time()}. If the input
value can't be represented as a valid time, OverflowError is raised. value can't be represented as a valid time, OverflowError is raised.
\end{funcdesc} \end{funcdesc}
...@@ -120,48 +120,45 @@ be a floating point number to indicate a more precise sleep time. ...@@ -120,48 +120,45 @@ be a floating point number to indicate a more precise sleep time.
Convert a tuple representing a time as returned by \code{gmtime()} or Convert a tuple representing a time as returned by \code{gmtime()} or
\code{localtime()} to a string as specified by the format argument. \code{localtime()} to a string as specified by the format argument.
The following directives, shown without the optional field width and The following directives, shown without the optional field width and
precision specification, are replaced by the indicated characters: precision specification, are replaced by the indicated characters:
\begin{tabular}{lp{25em}} \begin{tableii}{|c|p{24em}|}{code}{Directive}{Meaning}
\%a & Locale's abbreviated weekday name. \\ \lineii{\%a}{Locale's abbreviated weekday name.}
\%A & Locale's full weekday name. \\ \lineii{\%A}{Locale's full weekday name.}
\%b & Locale's abbreviated month name. \\ \lineii{\%b}{Locale's abbreviated month name.}
\%B & Locale's full month name. \\ \lineii{\%B}{Locale's full month name.}
\%c & Locale's appropriate date and time representation. \\ \lineii{\%c}{Locale's appropriate date and time representation.}
\%d & Day of the month as a decimal number [01,31]. \\ \lineii{\%d}{Day of the month as a decimal number [01,31].}
\%H & Hour (24-hour clock) as a decimal number [00,23]. \\ \lineii{\%H}{Hour (24-hour clock) as a decimal number [00,23].}
\%I & Hour (12-hour clock) as a decimal number [01,12]. \\ \lineii{\%I}{Hour (12-hour clock) as a decimal number [01,12].}
\%j & Day of the year as a decimal number [001,366]. \\ \lineii{\%j}{Day of the year as a decimal number [001,366].}
\%m & Month as a decimal number [01,12]. \\ \lineii{\%m}{Month as a decimal number [01,12].}
\%M & Minute as a decimal number [00,59]. \\ \lineii{\%M}{Minute as a decimal number [00,59].}
\%p & Locale's equivalent of either AM or PM. \\ \lineii{\%p}{Locale's equivalent of either AM or PM.}
\%S & Second as a decimal number [00,61]. \\ \lineii{\%S}{Second as a decimal number [00,61].}
\%U & Week number of the year (Sunday as the first day of the \lineii{\%U}{Week number of the year (Sunday as the first day of the
week) as a decimal number [00,53]. All days in a new week) as a decimal number [00,53]. All days in a new year
year preceding the first Sunday are considered to be in preceding the first Sunday are considered to be in week 0.}
week 0. \\ \lineii{\%w}{Weekday as a decimal number [0(Sunday),6].}
\%w & Weekday as a decimal number [0(Sunday),6]. \\ \lineii{\%W}{Week number of the year (Monday as the first day of the
\%W & Week number of the year (Monday as the first day of the week) as a decimal number [00,53]. All days in a new year
week) as a decimal number [00,53]. All days in a new preceding the first Sunday are considered to be in week 0.}
year preceding the first Sunday are considered to be in \lineii{\%x}{Locale's appropriate date representation.}
week 0. \\ \lineii{\%X}{Locale's appropriate time representation.}
\%x & Locale's appropriate date representation. \\ \lineii{\%y}{Year without century as a decimal number [00,99].}
\%X & Locale's appropriate time representation. \\ \lineii{\%Y}{Year with century as a decimal number.}
\%y & Year without century as a decimal number [00,99]. \\ \lineii{\%Z}{Time zone name (or by no characters if no time zone exists).}
\%Y & Year with century as a decimal number. \\ \lineii{\%\%}{\%}
\%Z & Time zone name (or by no characters if no time zone \end{tableii}
exists). \\
\%\% & \% \\ Additional directives may be supported on certain platforms, but
\end{tabular} only the ones listed here have a meaning standardized by ANSI C.
Additional directives may be supported on certain platforms, but On some platforms, an optional field width and precision
only the ones listed here have a meaning standardized by ANSI C. specification can immediately follow the initial \% of a
directive in the following order; this is also not portable.
On some platforms, an optional field width and precision The field width is normally 2 except for \%j where it is 3.
specification can immediately follow the initial \% of a
directive in the following order; this is also not portable.
The field width is normally 2 except for \%j where it is 3.
\end{funcdesc} \end{funcdesc}
......
...@@ -10,7 +10,7 @@ An explanation of some terminology and conventions is in order. ...@@ -10,7 +10,7 @@ An explanation of some terminology and conventions is in order.
\item \item
The ``epoch'' is the point where the time starts. On January 1st of that The ``epoch'' is the point where the time starts. On January 1st of that
year, at 0 hours, the ``time since the epoch'' is zero. For UNIX, the year, at 0 hours, the ``time since the epoch'' is zero. For \UNIX{}, the
epoch is 1970. To find out what the epoch is, look at \code{gmtime(0)}. epoch is 1970. To find out what the epoch is, look at \code{gmtime(0)}.
\item \item
...@@ -29,15 +29,15 @@ in this respect. ...@@ -29,15 +29,15 @@ in this respect.
\item \item
The precision of the various real-time functions may be less than The precision of the various real-time functions may be less than
suggested by the units in which their value or argument is expressed. suggested by the units in which their value or argument is expressed.
E.g.\ on most UNIX systems, the clock ``ticks'' only 50 or 100 times a E.g.\ on most \UNIX{} systems, the clock ``ticks'' only 50 or 100 times a
second, and on the Mac, times are only accurate to whole seconds. second, and on the Mac, times are only accurate to whole seconds.
\item \item
On the other hand, the precision of \code{time()} and \code{sleep()} On the other hand, the precision of \code{time()} and \code{sleep()}
is better than their UNIX equivalents: times are expressed as floating is better than their \UNIX{} equivalents: times are expressed as floating
point numbers, \code{time()} returns the most accurate time available point numbers, \code{time()} returns the most accurate time available
(using UNIX \code{gettimeofday()} where available), and \code{sleep()} (using \UNIX{} \code{gettimeofday()} where available), and \code{sleep()}
will accept a time with a nonzero fraction (UNIX \code{select()} is will accept a time with a nonzero fraction (\UNIX{} \code{select()} is
used to implement this, where available). used to implement this, where available).
\item \item
...@@ -106,7 +106,7 @@ to 1 when DST applies to the given time. ...@@ -106,7 +106,7 @@ to 1 when DST applies to the given time.
This is the inverse function of \code{localtime}. Its argument is the This is the inverse function of \code{localtime}. Its argument is the
full 9-tuple (since the dst flag is needed --- pass -1 as the dst flag if full 9-tuple (since the dst flag is needed --- pass -1 as the dst flag if
it is unknown) which expresses the time it is unknown) which expresses the time
in \em{local} time, not UTC. It returns a floating in \emph{local} time, not UTC. It returns a floating
point number, for compatibility with \code{time.time()}. If the input point number, for compatibility with \code{time.time()}. If the input
value can't be represented as a valid time, OverflowError is raised. value can't be represented as a valid time, OverflowError is raised.
\end{funcdesc} \end{funcdesc}
...@@ -120,48 +120,45 @@ be a floating point number to indicate a more precise sleep time. ...@@ -120,48 +120,45 @@ be a floating point number to indicate a more precise sleep time.
Convert a tuple representing a time as returned by \code{gmtime()} or Convert a tuple representing a time as returned by \code{gmtime()} or
\code{localtime()} to a string as specified by the format argument. \code{localtime()} to a string as specified by the format argument.
The following directives, shown without the optional field width and The following directives, shown without the optional field width and
precision specification, are replaced by the indicated characters: precision specification, are replaced by the indicated characters:
\begin{tabular}{lp{25em}} \begin{tableii}{|c|p{24em}|}{code}{Directive}{Meaning}
\%a & Locale's abbreviated weekday name. \\ \lineii{\%a}{Locale's abbreviated weekday name.}
\%A & Locale's full weekday name. \\ \lineii{\%A}{Locale's full weekday name.}
\%b & Locale's abbreviated month name. \\ \lineii{\%b}{Locale's abbreviated month name.}
\%B & Locale's full month name. \\ \lineii{\%B}{Locale's full month name.}
\%c & Locale's appropriate date and time representation. \\ \lineii{\%c}{Locale's appropriate date and time representation.}
\%d & Day of the month as a decimal number [01,31]. \\ \lineii{\%d}{Day of the month as a decimal number [01,31].}
\%H & Hour (24-hour clock) as a decimal number [00,23]. \\ \lineii{\%H}{Hour (24-hour clock) as a decimal number [00,23].}
\%I & Hour (12-hour clock) as a decimal number [01,12]. \\ \lineii{\%I}{Hour (12-hour clock) as a decimal number [01,12].}
\%j & Day of the year as a decimal number [001,366]. \\ \lineii{\%j}{Day of the year as a decimal number [001,366].}
\%m & Month as a decimal number [01,12]. \\ \lineii{\%m}{Month as a decimal number [01,12].}
\%M & Minute as a decimal number [00,59]. \\ \lineii{\%M}{Minute as a decimal number [00,59].}
\%p & Locale's equivalent of either AM or PM. \\ \lineii{\%p}{Locale's equivalent of either AM or PM.}
\%S & Second as a decimal number [00,61]. \\ \lineii{\%S}{Second as a decimal number [00,61].}
\%U & Week number of the year (Sunday as the first day of the \lineii{\%U}{Week number of the year (Sunday as the first day of the
week) as a decimal number [00,53]. All days in a new week) as a decimal number [00,53]. All days in a new year
year preceding the first Sunday are considered to be in preceding the first Sunday are considered to be in week 0.}
week 0. \\ \lineii{\%w}{Weekday as a decimal number [0(Sunday),6].}
\%w & Weekday as a decimal number [0(Sunday),6]. \\ \lineii{\%W}{Week number of the year (Monday as the first day of the
\%W & Week number of the year (Monday as the first day of the week) as a decimal number [00,53]. All days in a new year
week) as a decimal number [00,53]. All days in a new preceding the first Sunday are considered to be in week 0.}
year preceding the first Sunday are considered to be in \lineii{\%x}{Locale's appropriate date representation.}
week 0. \\ \lineii{\%X}{Locale's appropriate time representation.}
\%x & Locale's appropriate date representation. \\ \lineii{\%y}{Year without century as a decimal number [00,99].}
\%X & Locale's appropriate time representation. \\ \lineii{\%Y}{Year with century as a decimal number.}
\%y & Year without century as a decimal number [00,99]. \\ \lineii{\%Z}{Time zone name (or by no characters if no time zone exists).}
\%Y & Year with century as a decimal number. \\ \lineii{\%\%}{\%}
\%Z & Time zone name (or by no characters if no time zone \end{tableii}
exists). \\
\%\% & \% \\ Additional directives may be supported on certain platforms, but
\end{tabular} only the ones listed here have a meaning standardized by ANSI C.
Additional directives may be supported on certain platforms, but On some platforms, an optional field width and precision
only the ones listed here have a meaning standardized by ANSI C. specification can immediately follow the initial \% of a
directive in the following order; this is also not portable.
On some platforms, an optional field width and precision The field width is normally 2 except for \%j where it is 3.
specification can immediately follow the initial \% of a
directive in the following order; this is also not portable.
The field width is normally 2 except for \%j where it is 3.
\end{funcdesc} \end{funcdesc}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment