source: trunk/minix/man/man3/ctime.3@ 15

Last change on this file since 15 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 3.3 KB
RevLine 
[9]1.\" Copyright (c) 1980 Regents of the University of California.
2.\" All rights reserved. The Berkeley software License Agreement
3.\" specifies the terms and conditions for redistribution.
4.\"
5.\" @(#)ctime.3 6.8 (Berkeley) 4/2/87
6.\"
7.TH CTIME 3 "April 2, 1987"
8.UC 4
9.SH NAME
10ctime, localtime, gmtime, asctime, tzset \- convert date and time to ASCII
11.SH SYNOPSIS
12.nf
13.ft B
14#include <sys/types.h>
15#include <time.h>
16
17void tzset(void)
18char *ctime(const time_t *\fIclock\fP)
19char *asctime(const struct tm *\fItm\fP)
20struct tm *localtime(const time_t *\fIclock\fP)
21struct tm *gmtime(const time_t *\fIclock\fP)
22.fi
23.SH DESCRIPTION
24\fBTzset\fP uses the value of the environment variable \fBTZ\fP to
25set up the time conversion information used by \fBlocaltime\fP.
26.PP
27If \fBTZ\fP does not appear in the environment, the \fBTZDEFAULT\fP
28file (as defined in \fI<tzfile.h>\fP) is used by \fBlocaltime\fP. If
29this file fails for any reason, the GMT offset as provided by the
30kernel is used. In this case, DST is ignored, resulting in the time
31being incorrect by some amount if DST is currently in effect. If
32this fails for any reason, GMT is used.
33.PP
34If \fBTZ\fP appears in the environment but its value is a null string,
35Greenwich Mean Time is used; if \fBTZ\fP appears and begins with a
36slash, it is used as the absolute pathname of the \fBtzfile\fP(5)-format
37file from which to read the time conversion information; if \fBTZ\fP
38appears and begins with a character other than a slash, it's used as
39a pathname relative to the system time conversion information directory,
40defined as \fBTZDIR\fP in the include file \fBtzfile.h\fP. If this file
41fails for any reason, the GMT offset as provided by the kernel is
42used, as described above. If this fails for any reason, GMT is used.
43See
44.BR TZ (5)
45for a proper description of the
46.B TZ
47variable.
48.PP
49\fBCtime\fP converts a time value, pointed to by \fIclock\fP,
50such as returned by \fBtime\fP(2) into ASCII and returns a pointer
51to a 26-character string in the following form. All the fields
52have constant width.
53.PP
54.RS
55.nf
56Sun Sep 16 01:03:52 1973\en\e0
57.fi
58.RE
59.PP
60.B Localtime
61and
62.B gmtime
63return pointers to structures containing
64the broken-down time.
65.B Localtime
66corrects for the time zone and possible daylight savings time;
67.B gmtime
68converts directly to GMT, which is the time UNIX uses.
69.B Asctime
70converts a broken-down time to ASCII and returns a pointer
71to a 26-character string.
72.PP
73The structure declaration from the include file is:
74.PP
75.RS
76.nf
77.nr .0 .8i+\w'int tm_isdst'u
78.ta .5i \n(.0u \n(.0u+\w'/* 0-000'u+1n
79struct tm {
80 int tm_sec; /* 0-59 seconds */
81 int tm_min; /* 0-59 minutes */
82 int tm_hour; /* 0-23 hour */
83 int tm_mday; /* 1-31 day of month */
84 int tm_mon; /* 0-11 month */
85 int tm_year; /* 0- year \- 1900 */
86 int tm_wday; /* 0-6 day of week (Sunday = 0) */
87 int tm_yday; /* 0-365 day of year */
88 int tm_isdst; /* flag: daylight savings time in effect */
89};
90.fi
91.RE
92.PP
93\fBTm_isdst\fP is non-zero if a time zone adjustment such as Daylight
94Savings time is in effect.
95.SH FILES
96.ta \w'/usr/lib/zoneinfo\0\0'u
97/usr/lib/zoneinfo time zone information directory
98.br
99/etc/localtime local time zone file
100.SH SEE ALSO
101.BR time (2),
102.BR getenv (3),
103.BR tzfile (5),
104.BR TZ (5),
105.BR environ (7),
106.BR zic (8).
107.SH NOTE
108The return values point to static data whose content is overwritten by
109each call.
Note: See TracBrowser for help on using the repository browser.