Format
#include <time.h>
struct tm *localtime64(const time64_t *timeval);
Language Level: ILE C Extension
Threadsafe: No. Use localtime64_r() instead.
Locale Sensitive: The behavior of this function might be affected by the LC_TOD category of the current locale.
Description
The localtime64() function converts a time value, in seconds, to a structure of type tm.
The localtime64() function takes a timeval assumed to be Universal Coordinate Time (UTC) and converts it to job locale time. For this conversion, localtime64() checks the current locale setting for local time zone and daylight saving time (DST). If these values are not set in the current locale, localtime64() gets the local time zone and daylight saving time (DST) settings from the current job. Once converted, the time is returned in a structure of type tm. If the DST is set in the locale but the time zone information is not, the DST information in the locale is ignored.
The time value is usually obtained by a call to the time64() function.
Return Value
The localtime64() function returns a pointer to the structure result. If the given timeval is out of range, a NULL pointer is returned and errno is set to EOVERFLOW.
Example that uses localtime64()
This example queries the system clock and displays the local time.
#include <stdio.h>
#include <time.h>
int main(void)
{
struct tm *newtime;
time64_t ltime;
ltime = time64(<ime);
newtime = localtime64(<ime);
printf("The date and time is %s", asctime(newtime));
}
/************** If the local time is 3 p.m. February 15, 2008, **********
************************* the output should be: *********************
The date and time is Fri Feb 15 15:00:00 2008
*/
Related Information