![]() |
![]() |
![]() |
Convert calendar time to local time
#include <time.h> struct tm* localtime_r( const time_t* timer, struct tm* result );
libc
The localtime_r() function converts the calendar time pointed to by timer into local time, storing the information in the struct tm, result. Whenever localtime_r() is called, the tzset() function is also called.
The calendar time is usually obtained by using the time() function. That time is Coordinated Universal Time (UTC, formerly known as Greenwich Mean Time or GMT).
The time set on the computer with the date command reflects Coordinated Universal Time (UTC). The environment variable TZ is used to establish the local time zone. See the section "The TZ environment variable" in the Global Data and the TZ Environment Variable chapter for a discussion of how to set the time zone.
A pointer to result, the struct tm.
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |
asctime(), asctime_r(), clock(), ctime(), ctime_r(), difftime(), gmtime(), gmtime_r(), localtime(), mktime(), strftime(), time(), tm, tzset()
![]() |
![]() |
![]() |