purge remaining gpl code from clib, and make clib build again
[tangerine.git] / compiler / clib / localtime_r.c
blob0e1cc9c8cd37b09d0046d12d7e34e3de42b07489
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Convert a time into a string, reentrant.
6 */
8 extern long __gmtoffset;
10 /*****************************************************************************
12 NAME */
13 #include <time.h>
15 struct tm * localtime_r (
17 /* SYNOPSIS */
18 const time_t * tt,
19 struct tm * tm)
21 /* FUNCTION
22 Splits the system time in seconds into a structure.
23 The members of the tm structure are:
25 \begin{description}
26 \item {tm_sec} The number of seconds after the minute, normally in
27 the range 0 to 59, but can be up to 61 to allow for leap
28 seconds.
30 \item{tm_min} The number of minutes after the hour, in the range 0
31 to 59.
33 \item{tm_hour} The number of hours past midnight, in the range 0 to
34 23.
36 \item{tm_mday} The day of the month, in the range 1 to 31.
38 \item{tm_mon} The number of months since January, in the range 0 to
39 11.
41 \item{tm_year} The number of years since 1900.
43 \item{tm_wday} The number of days since Sunday, in the range 0 to
46 \item{tm_yday} The number of days since January 1, in the range 0
47 to 365.
49 \item{tm_isdst} A flag that indicates whether daylight saving time
50 is in effect at the time described. The value is positive
51 if daylight saving time is in effect, zero if it is not,
52 and negative if the information is not available.
54 \end{description}
56 INPUTS
57 tt - A time in seconds from the 1. Jan 1970
58 tm - A struct tm to store the result in
60 RESULT
61 The pointer passed in tm.
63 NOTES
65 EXAMPLE
66 time_t tt;
67 struct tm tm;
69 // Get time
70 time (&tt);
72 // Break time up
73 localtime_r (&tt, &tm);
75 BUGS
77 SEE ALSO
78 time(), ctime_r(), asctime_r(), gmtime_r()
80 INTERNALS
82 ******************************************************************************/
84 time_t ti = *tt;
86 ti -= __gmtoffset * 60;
88 return gmtime_r (&ti, tm);
89 } /* localtime_r */