Loading...
--- Libc/Libc-583/stdtime/ctime.3
+++ Libc/Libc-262/stdtime/ctime.3
@@ -32,7 +32,7 @@
.\" SUCH DAMAGE.
.\"
.\" From: @(#)ctime.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/stdtime/ctime.3,v 1.22 2004/07/02 23:52:12 ru Exp $
+.\" $FreeBSD: src/lib/libc/stdtime/ctime.3,v 1.11.2.6 2001/10/02 11:36:10 ru Exp $
.\"
.Dd January 2, 1999
.Dt CTIME 3
@@ -56,31 +56,31 @@
.In time.h
.Vt extern char *tzname[2] ;
.Ft char *
-.Fn asctime "const struct tm *timeptr"
-.Ft char *
-.Fn asctime_r "const struct tm *restrict timeptr" "char *restrict buf"
-.Ft char *
.Fn ctime "const time_t *clock"
-.Ft char *
-.Fn ctime_r "const time_t *clock" "char *buf"
.Ft double
.Fn difftime "time_t time1" "time_t time0"
-.Ft struct tm *
-.Fn gmtime "const time_t *clock"
-.Ft struct tm *
-.Fn gmtime_r "const time_t *clock" "struct tm *result"
+.Ft char *
+.Fn asctime "const struct tm *tm"
.Ft struct tm *
.Fn localtime "const time_t *clock"
.Ft struct tm *
+.Fn gmtime "const time_t *clock"
+.Ft time_t
+.Fn mktime "struct tm *tm"
+.Ft time_t
+.Fn timegm "struct tm *tm"
+.Ft char *
+.Fn ctime_r "const time_t *clock" "char *buf"
+.Ft struct tm *
.Fn localtime_r "const time_t *clock" "struct tm *result"
-.Ft time_t
-.Fn mktime "struct tm *timeptr"
-.Ft time_t
-.Fn timegm "struct tm *timeptr"
+.Ft struct tm *
+.Fn gmtime_r "const time_t *clock" "struct tm *result"
+.Ft char *
+.Fn asctime_r "const struct tm *tm" "char *buf"
.Sh DESCRIPTION
The functions
.Fn ctime ,
-.Fn gmtime ,
+.Fn gmtime
and
.Fn localtime
all take as an argument a time value representing the time in seconds since
@@ -92,10 +92,10 @@
The function
.Fn localtime
converts the time value pointed at by
-.Fa clock .
-It returns a pointer to a
+.Fa clock ,
+and returns a pointer to a
.Dq Fa struct tm
-(described below), which contains
+(described below) which contains
the broken-out time information for the value after adjusting for the current
time zone (and any other factors such as Daylight Saving Time).
Time zone adjustments are performed as specified by the
@@ -106,7 +106,7 @@
.Fn localtime
uses
.Xr tzset 3
-to initialize time conversion information, if
+to initialize time conversion information if
.Xr tzset 3
has not already been called by the process.
.Pp
@@ -118,98 +118,86 @@
.Fa tzname
to a pointer to an
.Tn ASCII
-string containing the time zone abbreviation to be
+string that's the time zone abbreviation to be
used with
.Fn localtime Ns 's
return value.
.Pp
The function
.Fn gmtime
-also converts the time value, but makes no time zone adjustment.
-It returns a pointer to a tm structure (described below).
+similarly converts the time value, but without any time zone adjustment,
+and returns a pointer to a tm structure (described below).
.Pp
The
.Fn ctime
function
-adjusts the time value for the current time zone, in the same manner as
-.Fn localtime .
-It returns a pointer to a 26-character string of the form:
+adjusts the time value for the current time zone in the same manner as
+.Fn localtime ,
+and returns a pointer to a 26-character string of the form:
.Bd -literal -offset indent
Thu Nov 24 18:22:48 1986\en\e0
.Ed
.Pp
-All of the fields have constant width.
-.Pp
-The
+All the fields have constant width.
+.Pp
.Fn ctime_r
-function
provides the same functionality as
-.Fn ctime ,
-except that the caller must provide the output buffer
+.Fn ctime
+except the caller must provide the output buffer
.Fa buf
-(which must be at least 26 characters long) to store the result.
-The
+to store the result, which must be at least 26 characters long.
.Fn localtime_r
and
.Fn gmtime_r
-functions
provide the same functionality as
.Fn localtime
and
-.Fn gmtime ,
+.Fn gmtime
respectively, except the caller must provide the output buffer
.Fa result .
.Pp
The
.Fn asctime
function
-converts the broken-out time in the structure
+converts the broken down time in the structure
.Fa tm
-(pointed at by
-.Fa *timeptr )
+pointed at by
+.Fa *tm
to the form
shown in the example above.
.Pp
-The
.Fn asctime_r
-function
provides the same functionality as
-.Fn asctime ,
-except that the caller provides the output buffer
+.Fn asctime
+except the caller provide the output buffer
.Fa buf
-(which must be at least 26 characters long) to store the result.
+to store the result, which must be at least 26 characters long.
.Pp
The functions
.Fn mktime
and
.Fn timegm
-convert the broken-out time
-(in the structure pointed to by
-.Fa *timeptr )
-into a time value with the same encoding as that of the
+convert the broken-down time in the structure
+pointed to by tm into a time value with the same encoding as that of the
values returned by the
.Xr time 3
function (that is, seconds from the Epoch,
.Tn UTC ) .
-The
-.Fn mktime
-function
+.Fn mktime
interprets the input structure according to the current timezone setting
(see
.Xr tzset 3 ) .
-The
.Fn timegm
-function interprets the input structure
-as representing Universal Coordinated Time
+interprets the input structure as representing Universal Coordinated Time
.Pq Tn UTC .
.Pp
The original values of the
.Fa tm_wday
and
.Fa tm_yday
-components of the structure are ignored. The original values of the
-other components are not restricted to their normal ranges and will be
-normalized, if need be.
+components of the structure are ignored, and the original values of the
+other components are not restricted to their normal ranges, and will be
+normalized if needed.
For example,
October 40 is changed into November 9,
a
@@ -225,7 +213,7 @@
causes
.Fn mktime
to presume initially that summer time (for example, Daylight Saving Time)
-is or is not (respectively) in effect for the specified time.
+is or is not in effect for the specified time, respectively.
A negative value for
.Fa tm_isdst
causes the
@@ -252,9 +240,7 @@
and
.Fa tm_year
are determined.
-The
-.Fn mktime
-function
+.Fn Mktime
returns the specified calendar time; if the calendar time cannot be
represented, it returns \-1;
.Pp
@@ -267,9 +253,8 @@
.Fa time0 ) ,
expressed in seconds.
.Pp
-External declarations, as well as the tm structure definition,
-are contained in the
-.In time.h
+External declarations as well as the tm structure definition are in the
+.Aq Pa time.h
include file.
The tm structure includes at least the following fields:
.Bd -literal -offset indent
@@ -289,14 +274,14 @@
The
field
.Fa tm_isdst
-is non-zero if summer (i.e., Daylight Saving) time is in effect.
+is non-zero if summer time is in effect.
.Pp
The field
.Fa tm_gmtoff
is the offset (in seconds) of the time represented from
.Tn UTC ,
with positive
-values indicating locations east of the Prime Meridian.
+values indicating east of the Prime Meridian.
.Sh SEE ALSO
.Xr date 1 ,
.Xr gettimeofday 2 ,
@@ -357,17 +342,14 @@
The C Standard provides no mechanism for a program to modify its current
local timezone setting, and the
.Tn POSIX Ns No \&-standard
-method is not reentrant.
-(However, thread-safe implementations are provided
+method is not reentrant. (However, thread-safe implementations are provided
in the
.Tn POSIX
threaded environment.)
.Pp
The
-.Va tm_zone
-field of a returned
-.Vt tm
-structure points to a static array of characters,
+.Fa tm_zone
+field of a returned tm structure points to a static array of characters,
which will also be overwritten by any subsequent calls (as well as by
subsequent calls to
.Xr tzset 3