ctime_r()

convert epoch time to local time (reentrant version> 

Function


SYNOPSIS

#include <time.h>

char *ctime_r(const time_t *clock, char *buf);


DESCRIPTION

The ctime_r() function converts the epoch time pointed to by clock to local time in the form of a string. It is equivalent to:

asctime_r(localtime(clock), buf);

The string returned by ctime_r() is in the form:

Sun Sep 16 01:03:52
1973\n\0

A side-effect of calling ctime_r() is that the global variables tzname, timezone, and daylight are set based on the value of environment variable TZ, exactly as though the function tzset() had been called. The string generated by ctime_r() is in the local time specified by TZ.

This function is reentrant.


PARAMETERS

clock 

Points to the time to be converted to string format.

buf 

Specifies the buffer where the converted time is stored. This buffer must be at least 26 bytes.


RETURN VALUES

On success, ctime_r() returns buf. On error, it returns NULL.


CONFORMANCE

POSIX.1 (1996).


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

Refer to tzset() for details on setting time zone information.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
asctime(), asctime_r(), clock(), ctime(), difftime(), gmtime(), gmtime_r(), localtime(), localtime_r(), mktime(), strftime(), time(), tzset(), wcsftime()


PTC MKS Toolkit 10.4 Documentation Build 39.