The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group

 NAME

localtime, localtime_r - convert a time value to a broken-down local time

 SYNOPSIS



#include <time.h>

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

 DESCRIPTION

The localtime() function converts the time in seconds since the Epoch pointed to by timer into a broken-down time, expressed as a local time. The function corrects for the timezone and any seasonal time adjustments. Local timezone information is used as though localtime() calls tzset().

The localtime() interface need not be reentrant.

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.

 RETURN VALUE

The localtime() function returns a pointer to the broken-down time structure.

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

 ERRORS

No errors are defined.

 EXAMPLES

None.

 APPLICATION USAGE

The asctime(), ctime(), getdate(), gettimeofday(), gmtime() and localtime() functions return values in one of two static objects: a broken-down time structure and an array of char. Execution of any of the functions may overwrite the information returned in either of these objects by any of the other functions.

 FUTURE DIRECTIONS

None.

 SEE ALSO

asctime(), clock(), ctime(), difftime(), getdate(), gettimeofday(), gmtime(), mktime(), strftime(), strptime(), time(), utime(), <time.h>.

DERIVATION

localtime() derived from Issue 1 of the SVID.

localtime_r() derived from the POSIX Threads Extension (1003.1c-1995).


UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]