localtime_r()

Convert calendar time to local time

Synopsis:

#include <time.h>

struct tm* localtime_r( const time_t* timer,
                        struct tm* result );

Arguments:

timer
A pointer to a time_t object that contains the calendar time that you want to convert.
result
A pointer to a tm structure where the function can store the converted time.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The localtime_r() function converts the calendar time pointed to by timer into local time, storing the information in the struct tm that result points to. Whenever you call localtime_r(), it calls tzset().

You typically get a calendar time by calling time(). That time is Coordinated Universal Time (UTC, formerly known as Greenwich Mean Time or GMT).

You typically use the date command to set the computer's internal clock using Coordinated Universal Time (UTC). Use the TZ environment variable or _CS_TIMEZONE configuration string to establish the local time zone. For more information, see Setting the time zone in the Configuring Your Environment chapter of the QNX Neutrino User's Guide.

Returns:

On success, a pointer to the static tm structure containing the time information. On failure, NULL (errno is set).

Errors:

EOVERFLOW
The requested time value can't be represented.

Classification:

POSIX 1003.1

Safety:  
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes