mlib update: new isnan()/isnanf() implementation
[tangerine.git] / compiler / clib / localtime.c
blobb1c9908c075d346584050470079b61e46ee119fb
1 /*
2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
3 $Id$
5 Convert a time into a string.
6 */
8 extern long __gmtoffset;
10 /*****************************************************************************
12 NAME */
13 #include <time.h>
15 struct tm * localtime (
17 /* SYNOPSIS */
18 const time_t * tt)
20 /* FUNCTION
21 Splits the system time in seconds into a structure.
22 The members of the tm structure are:
24 \begin{description}
25 \item {tm_sec} The number of seconds after the minute, normally in
26 the range 0 to 59, but can be up to 61 to allow for leap
27 seconds.
29 \item{tm_min} The number of minutes after the hour, in the range 0
30 to 59.
32 \item{tm_hour} The number of hours past midnight, in the range 0 to
33 23.
35 \item{tm_mday} The day of the month, in the range 1 to 31.
37 \item{tm_mon} The number of months since January, in the range 0 to
38 11.
40 \item{tm_year} The number of years since 1900.
42 \item{tm_wday} The number of days since Sunday, in the range 0 to
45 \item{tm_yday} The number of days since January 1, in the range 0
46 to 365.
48 \item{tm_isdst} A flag that indicates whether daylight saving time
49 is in effect at the time described. The value is positive
50 if daylight saving time is in effect, zero if it is not,
51 and negative if the information is not available.
53 \end{description}
55 INPUTS
56 tt - A time in seconds from the 1. Jan 1970
58 RESULT
59 A statically allocated buffer with the broken up time. Note that
60 the contents of the buffer might get lost with the call of any of
61 the date and time functions.
63 NOTES
64 This function must not be used in a shared library or
65 in a threaded application.
67 EXAMPLE
68 time_t tt;
69 struct tm * tm;
71 // Get time
72 time (&tt);
74 // Break time up
75 tm = localtime (&tt);
77 BUGS
79 SEE ALSO
80 time(), ctime(), asctime()
82 INTERNALS
84 ******************************************************************************/
86 time_t ti = *tt;
88 ti -= __gmtoffset * 60;
90 return gmtime (&ti);
91 } /* localtime */