localtime_r(), localtime64_r() — Convert time value to broken-down local time

Standards

Standards / Extensions C or C++ Dependencies

Single UNIX Specification, Version 2
Single UNIX Specification, Version 3
Language Environment®

both OS/390 V2R8

Format

#define _XOPEN_SOURCE 500
#include <time.h>

struct tm *localtime_r(const time_t *__restrict__ clock,
                       struct tm *__restrict__ result);
#define _LARGE_TIME_API
#include <time.h>

struct tm *localtime64_r(const time64_t *__restrict__ clock, 
                       struct tm *__restrict__ result);
Compile requirement: Use of localtime64_r() function requires the long long data type. See z/OS XL C/C++ Language Reference for information on how to make long long available.

General description

The localtime_r() function converts the calendar time pointed to by clock into a broken-down time stored in the structure to which result points. The localtime_r() function also returns a pointer to that same structure.

Unlike localtime(), the reentrant version is not required to set tzname.

The localtime64_r() function behaves exactly like localtime_r() except it will break down a time64_t value pointing to a calendar time beyond 03:14:07 UTC on January 19, 2038 with a limit of 23:59:59 UTC on December 31, 9999.

Returned value

If successful, localtime_r() returns a pointer to the structure pointed to by the argument result.

If an error is detected, localtime() returns a null pointer and set errno to indicate the error.

Error Code
Description
EOVERFLOW
The result cannot be represented.

Related information