Cygwin: mmap: allow remapping part of an existing anonymous mapping
[newlib-cygwin.git] / newlib / libc / time / lcltime.c
blobded98c57aef811e695cfe874da3e06823ff092f9
1 /*
2 * localtime.c
3 */
5 /*
6 FUNCTION
7 <<localtime>>---convert time to local representation
9 INDEX
10 localtime
11 INDEX
12 localtime_r
14 SYNOPSIS
15 #include <time.h>
16 struct tm *localtime(time_t *<[clock]>);
17 struct tm *localtime_r(time_t *<[clock]>, struct tm *<[res]>);
19 DESCRIPTION
20 <<localtime>> converts the time at <[clock]> into local time, then
21 converts its representation from the arithmetic representation to the
22 traditional representation defined by <<struct tm>>.
24 <<localtime>> constructs the traditional time representation in static
25 storage; each call to <<gmtime>> or <<localtime>> will overwrite the
26 information generated by previous calls to either function.
28 <<mktime>> is the inverse of <<localtime>>.
30 RETURNS
31 A pointer to the traditional time representation (<<struct tm>>).
33 PORTABILITY
34 ANSI C requires <<localtime>>.
36 <<localtime>> requires no supporting OS subroutines.
39 #include <stdlib.h>
40 #include <time.h>
41 #include <reent.h>
43 #ifndef _REENT_ONLY
45 struct tm *
46 localtime (const time_t * tim_p)
48 struct _reent *reent = _REENT;
50 _REENT_CHECK_TM(reent);
51 return localtime_r (tim_p, (struct tm *)_REENT_TM(reent));
54 #endif