NAME
ctime, localtime, gmtime, asctime, tm2sec, timezone – convert date
and time |
SYNOPSIS
#include <u.h> #include <libc.h> char* ctime(long clock) Tm* localtime(long clock) Tm* gmtime(long clock) char* asctime(Tm *tm) long tm2sec(Tm *tm)
/env/timezone |
DESCRIPTION
Ctime converts a time clock such as returned by time(2) into ASCII
(sic) and returns a pointer to a 30–byte string in the following
form. All the fields have constant width.
When local time is first requested, the program consults the timezone
environment variable to determine the time zone and converts accordingly.
(This variable is set at system boot time by init(8).) The timezone
variable contains the normal time zone name and its difference
from GMT in seconds followed by an
alternate (daylight) time zone name and its difference followed
by a newline. The remainder is a list of pairs of times (seconds
past the start of 1970, in the first time zone) when the alternate
time zone applies. For example:
|
SOURCE
/sys/src/libc/9sys |
SEE ALSO
date(1), time(2), init(8) |
BUGS
The return values point to static data whose content is overwritten
by each call. Daylight Savings Time is ``normal'' in the Southern hemisphere. These routines are not equipped to handle non–ASCII text, and are provincial anyway.
These interfaces are fixed, but all occurrences of long in the
above should be manipulated as ulong; this extends the range of
valid times into the year 2106. |