return the created object..
[AROS.git] / compiler / stdc / localtime_r.c
blob80ef86267c5c318e14f31e213f98f8c03ef9dac8
1 /*
2 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
3 $Id$
5 Convert a time into a string, reentrant.
6 */
8 /*****************************************************************************
10 NAME */
11 #include <time.h>
13 struct tm * localtime_r (
15 /* SYNOPSIS */
16 const time_t * tt,
17 struct tm * tm)
19 /* FUNCTION
20 Splits the system time in seconds into a structure.
21 The members of the tm structure are:
23 tm_sec - The number of seconds after the minute, normally in
24 the range 0 to 59, but can be up to 61 to allow for leap
25 seconds.
27 tm_min - The number of minutes after the hour, in the range 0 to 59.
29 tm_hour - The number of hours past midnight, in the range 0 to 23.
31 tm_mday - The day of the month, in the range 1 to 31.
33 tm_mon - The number of months since January, in the range 0 to 11.
35 tm_year - The number of years since 1900.
37 tm_wday - The number of days since Sunday, in the range 0 to 6.
39 tm_yday - The number of days since January 1, in the range 0 to 365.
41 tm_isdst - A flag that indicates whether daylight saving time
42 is in effect at the time described. The value is positive
43 if daylight saving time is in effect, zero if it is not,
44 and negative if the information is not available.
46 INPUTS
47 tt - A time in seconds from the 1. Jan 1970
48 tm - A struct tm to store the result in
50 RESULT
51 The pointer passed in tm.
53 NOTES
55 EXAMPLE
56 time_t tt;
57 struct tm tm;
59 // Get time
60 time (&tt);
62 // Break time up
63 localtime_r (&tt, &tm);
65 BUGS
67 SEE ALSO
68 time(), ctime_r(), asctime_r(), gmtime_r()
70 INTERNALS
72 ******************************************************************************/
74 time_t ti = *tt;
76 ti -= __stdc_gmtoffset() * 60;
78 return gmtime_r (&ti, tm);
79 } /* localtime_r */