Retro68/gcc/newlib/libc/time/lcltime.c

55 lines
1.1 KiB
C
Raw Normal View History

2017-04-11 21:13:36 +00:00
/*
* localtime.c
*/
/*
FUNCTION
<<localtime>>---convert time to local representation
INDEX
localtime
INDEX
localtime_r
2018-12-28 15:30:48 +00:00
SYNOPSIS
2017-04-11 21:13:36 +00:00
#include <time.h>
struct tm *localtime(time_t *<[clock]>);
struct tm *localtime_r(time_t *<[clock]>, struct tm *<[res]>);
DESCRIPTION
<<localtime>> converts the time at <[clock]> into local time, then
converts its representation from the arithmetic representation to the
traditional representation defined by <<struct tm>>.
<<localtime>> constructs the traditional time representation in static
storage; each call to <<gmtime>> or <<localtime>> will overwrite the
information generated by previous calls to either function.
<<mktime>> is the inverse of <<localtime>>.
RETURNS
A pointer to the traditional time representation (<<struct tm>>).
PORTABILITY
ANSI C requires <<localtime>>.
<<localtime>> requires no supporting OS subroutines.
*/
2018-12-28 15:30:48 +00:00
#include <stdlib.h>
2017-04-11 21:13:36 +00:00
#include <time.h>
#include <reent.h>
#ifndef _REENT_ONLY
struct tm *
2018-12-28 15:30:48 +00:00
localtime (const time_t * tim_p)
2017-04-11 21:13:36 +00:00
{
struct _reent *reent = _REENT;
_REENT_CHECK_TM(reent);
return localtime_r (tim_p, (struct tm *)_REENT_TM(reent));
2017-04-11 21:13:36 +00:00
}
#endif