INtime SDK Help
localtime

Converts a time stored as a time_t value and corrects for the local timezone.


#include <time.h>

struct tm *localtime(const time_t *timer);
struct tm *_localtime32(const __time32_t *timer);
struct tm *_localtime64(const __time64_t *timer);

struct tm *localtime_s(const time_t *timer, struct tm *result);
struct tm *_localtime32_s(const __time32_t *timer, struct tm *result);
struct tm *_localtime64_s(const __time64_t *timer, struct tm *result);

Parameters

timer
Pointer to stored time, which represents the seconds elapsed since epoch time; this value is usually obtained from time.

Remarks

localtime makes corrections for the local timezone if the user first sets the environment variable TZ. Then, three other environment variables (timezone, daylight, and tzname) are automatically set as well.

TZ is not part of the ANSI standard definition of localtime.

gmtime, mktime, and localtime use a single statically allocated TM structure for the conversion. Each call to one of these functions destroys the result of the previous call.

localtime_s is a secure version of localtime where a buffer to receive the result may be passed to the call.

localtime() is a wrapper for _localtime32() and time_t is, by default, equivalent to __time32_t. If you need to force the compiler to interpret time_t as the new 64-bit __time64_t, you can define _USE_64BIT_TIME_T. This is recommended to ensure that your application does not fail after January 18, 2038, but is not backwards-compatible with previous versions of INtime.

Similarly, localtime_s() is a wrapper for _localtime32_s unless _USE_64BIT_TIME_T is defined, when it is a wrapper for _localtime64_s.

Return Values

A pointer to the TM structure, which has the integer elements described in TIME.H. A NULL value indicates failure and the errno variable can be checked for extended status.

Requirements

Versions Defined in Include Link to
INtime 3.0
INtime 6.0 (locatime_s)
intime/rt/include/time.h time.h clib.lib
See Also