1 058b0118 2005-01-03 devnull .TH CTIME 3
3 058b0118 2005-01-03 devnull ctime, localtime, gmtime, asctime, tm2sec, timezone \- convert date and time
4 058b0118 2005-01-03 devnull .SH SYNOPSIS
5 058b0118 2005-01-03 devnull .B #include <u.h>
7 058b0118 2005-01-03 devnull .B #include <libc.h>
9 058b0118 2005-01-03 devnull .ta \w'\fLchar* 'u
11 058b0118 2005-01-03 devnull char* ctime(long clock)
14 058b0118 2005-01-03 devnull Tm* localtime(long clock)
17 058b0118 2005-01-03 devnull Tm* gmtime(long clock)
20 058b0118 2005-01-03 devnull char* asctime(Tm *tm)
23 058b0118 2005-01-03 devnull long tm2sec(Tm *tm)
24 058b0118 2005-01-03 devnull .SH DESCRIPTION
26 058b0118 2005-01-03 devnull converts a time
28 058b0118 2005-01-03 devnull such as returned by
29 058b0118 2005-01-03 devnull .IR time (3)
31 058b0118 2005-01-03 devnull .SM ASCII
33 058b0118 2005-01-03 devnull and returns a pointer to a
34 058b0118 2005-01-03 devnull 30-byte string
35 058b0118 2005-01-03 devnull in the following form.
36 058b0118 2005-01-03 devnull All the fields have constant width.
39 058b0118 2005-01-03 devnull Wed Aug 5 01:07:47 EST 1973\en\e0
41 058b0118 2005-01-03 devnull .I Localtime
43 058b0118 2005-01-03 devnull .I gmtime
44 058b0118 2005-01-03 devnull return pointers to structures containing
45 058b0118 2005-01-03 devnull the broken-down time.
46 058b0118 2005-01-03 devnull .I Localtime
47 058b0118 2005-01-03 devnull corrects for the time zone and possible daylight savings time;
48 058b0118 2005-01-03 devnull .I gmtime
49 058b0118 2005-01-03 devnull converts directly to GMT.
50 058b0118 2005-01-03 devnull .I Asctime
51 058b0118 2005-01-03 devnull converts a broken-down time to
52 058b0118 2005-01-03 devnull .SM ASCII
53 058b0118 2005-01-03 devnull and returns a pointer
54 058b0118 2005-01-03 devnull to a 30-byte string.
57 058b0118 2005-01-03 devnull .ta 6n +\w'char 'u +\w'zone[4]; 'u
60 058b0118 2005-01-03 devnull int sec; /* seconds (range 0..59) */
61 058b0118 2005-01-03 devnull int min; /* minutes (0..59) */
62 058b0118 2005-01-03 devnull int hour; /* hours (0..23) */
63 058b0118 2005-01-03 devnull int mday; /* day of the month (1..31) */
64 058b0118 2005-01-03 devnull int mon; /* month of the year (0..11) */
65 058b0118 2005-01-03 devnull int year; /* year A.D. \- 1900 */
66 058b0118 2005-01-03 devnull int wday; /* day of week (0..6, Sunday = 0) */
67 058b0118 2005-01-03 devnull int yday; /* day of year (0..365) */
68 058b0118 2005-01-03 devnull char zone[4]; /* time zone name */
69 058b0118 2005-01-03 devnull int tzoff; /* time zone delta from GMT */
73 058b0118 2005-01-03 devnull .I Tm2sec
74 058b0118 2005-01-03 devnull converts a broken-down time to
75 058b0118 2005-01-03 devnull seconds since the start of the epoch.
76 058b0118 2005-01-03 devnull It ignores
77 058b0118 2005-01-03 devnull .BR wday ,
78 058b0118 2005-01-03 devnull and assumes the local time zone
82 058b0118 2005-01-03 devnull .BR GMT .
83 058b0118 2005-01-03 devnull .SH SOURCE
84 c3674de4 2005-01-11 devnull .B \*9/src/lib9/date.c
86 c3674de4 2005-01-11 devnull .B \*9/src/lib9/ctime.c
87 058b0118 2005-01-03 devnull .SH "SEE ALSO"
88 058b0118 2005-01-03 devnull .IR date (1),
89 058b0118 2005-01-03 devnull .IR time (3)
91 058b0118 2005-01-03 devnull The return values point to static data
92 058b0118 2005-01-03 devnull whose content is overwritten by each call.
94 058b0118 2005-01-03 devnull Daylight Savings Time is ``normal'' in the Southern hemisphere.
96 058b0118 2005-01-03 devnull These routines are not equipped to handle non-\c
97 058b0118 2005-01-03 devnull .SM ASCII
98 058b0118 2005-01-03 devnull text, and are provincial anyway.
100 c8b6342d 2005-01-13 devnull To avoid name conflicts with the underlying system,
101 c8b6342d 2005-01-13 devnull .IR ctime ,
102 c8b6342d 2005-01-13 devnull .IR localtime ,
103 c8b6342d 2005-01-13 devnull .IR gmtime ,
104 c8b6342d 2005-01-13 devnull .IR asctime ,
106 c8b6342d 2005-01-13 devnull .I tm2sec
107 c8b6342d 2005-01-13 devnull are preprocessor macros defined as
108 c8b6342d 2005-01-13 devnull .IR p9ctime ,
109 c8b6342d 2005-01-13 devnull .IR p9localtime ,
110 c8b6342d 2005-01-13 devnull .IR p9gmtime ,
111 c8b6342d 2005-01-13 devnull .IR p9asctime ,
113 c8b6342d 2005-01-13 devnull .IR p9tm2sec ;
115 c8b6342d 2005-01-13 devnull .IR intro (3).