Open System Services System Calls Reference Manual (G06.28+)
System Functions (k - m) localtime_r(2)
NAME
localtime_r - Converts time since the Epoch to broken-down local time (reentrant)
LIBRARY
G-series native OSS processes: /G/system/sysnn/zsptsrl
H-series OSS processes: /G/system/zdllnnn/zsptdll
SYNOPSIS
[#include <time.h>]
#include <spthread.h>
struct tm *localtime_r (
const time_t *timer,
struct tm *result );
PARAMETERS
timer Points to a variable that specifies a time value in seconds.
result Points to the struct tm where the converted time is stored.
DESCRIPTION
The localtime_r( ) function is the reentrant version of the localtime() function.
The localtime_r( ) function converts the time in seconds since the Epoch, in a variable pointed to
by the timer parameter, into broken-down time, expressed as local time. This function corrects
for the timezone and any seasonal time adjustments.
Broken-down time is stored in the type tm structure pointed to by the return value of this func-
tion and by the pointer returned for result. The tm structure is defined in the time.h header file.
Local timezone information is set as though the tzset( ) function were called.
RETURN VALUES
Upon successful completion, the localtime_r() function returns a pointer to a type tm broken-
down time structure, which contains converted local time information. The return value of the
function might point to static storage, which might be overwritten by subsequent calls to any of
the following functions:
asctime()
asctime_r()
ctime()
ctime_r()
localtime()
localtime_r()
gmtime()
gmtime_r()
Values for the timeptr->tm_wday and timeptr->tm_yday members of the structure are set, and
the other members are set to specified local times. The final value of timeptr->tm_mday is not
set until the values of members timeptr->tm_mon and timeptr->tm_year are determined.
The values set in the tm structure are affected by the setting of the TZ environment variable and
calls to the tzset( ) function. Refer to the tzset(3) reference page for more information about the
TZ environment variable.
ERRORS
No error values are returned. This function does not set the errno variable.
527186-005 Hewlett-Packard Company 4−21