4.3BSD/usr/man/man3/ctime.3

Compare this file to the similar file:
Show the results in this format:

.\" Copyright (c) 1980 Regents of the University of California.
.\" All rights reserved.  The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
.\"	@(#)ctime.3	6.4 (Berkeley) 5/27/86
.\"
.TH CTIME 3  "May 27, 1986"
.UC 4
.SH NAME
ctime, localtime, gmtime, asctime, timezone \-  convert date and time to ASCII
.SH SYNOPSIS
.nf
.B char *ctime(clock)
.B long *clock;
.PP
.B #include <time.h>
.PP
.B struct tm *localtime(clock)
.B long *clock;
.PP
.B struct tm *gmtime(clock)
.B long *clock;
.PP
.B char *asctime(tm)
.B struct tm *tm;
.PP
.B char *timezone(zone, dst)
.fi
.SH DESCRIPTION
.I Ctime
converts a time pointed to by
.I clock
such as returned by
.IR time (2)
into ASCII
and returns a pointer to a
26-character string
in the following form.
All the fields have constant width.
.PP
    Sun Sep 16 01:03:52 1973\\n\\0
.PP
.I Localtime
and
.I gmtime
return pointers to structures containing
the broken-down time.
.I Localtime
corrects for the time zone and possible daylight savings time;
.I gmtime
converts directly to GMT, which is the time UNIX uses.
.I Asctime
converts a broken-down time to ASCII and returns a pointer
to a 26-character string.
.PP
The structure declaration from the include file is:
.PP
.RS
.nf
.nr .0 .8i+\w'int tm_isdst'u
.ta .5i \n(.0u \n(.0u+\w'/* 0-000'u+1n
struct tm {
	int tm_sec;	/* 0-59	seconds */
	int tm_min;	/* 0-59	minutes */
	int tm_hour;	/* 0-23	hour */
	int tm_mday;	/* 1-31	day of month */
	int tm_mon;	/* 0-11	month */
	int tm_year;	/* 0-	year \- 1900 */
	int tm_wday;	/* 0-6	day of week (Sunday = 0) */
	int tm_yday;	/* 0-365	day of year */
	int tm_isdst;	/* flag:	daylight savings time in effect */
};
.fi
.RE
.PP
When local time is called for,
the program consults the system to determine the time zone and
whether the U.S.A., Australian, Eastern European, Middle European,
or Western European daylight saving time adjustment is appropriate.
The program knows about various peculiarities in time conversion
over the past 10-20 years; if necessary, this understanding can
be extended.
.PP
.I Timezone
returns the name of the time zone associated with its first argument,
which is measured in minutes westward from Greenwich.
If the second argument is 0, the standard name is used,
otherwise the Daylight Saving version.
If the required name does not appear in a table
built into the routine,
the difference from GMT is produced; e.g.,
in Afghanistan
.I timezone(-(60*4+30), 0)
is appropriate because it is 4:30 ahead of GMT
and the string
.B GMT+4:30
is produced.
.SH "SEE ALSO"
gettimeofday(2), time(3)
.SH BUGS
The return values point to static data
whose content is overwritten by each call.