ctime, ctime_r - convert a time value to date and time string
#include <time.h> char *ctime(const time_t *clock); char *ctime_r(const time_t *clock, char *buf);
The ctime() function converts the time pointed to by clock, representing time in seconds since the Epoch, to local time in the form of a string. It is equivalent to:
The asctime(), ctime(), 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.
The ctime() interface need not be reentrant.
The ctime_r() function converts the calendar time pointed to by clock to local time in exactly the same form as ctime() and puts the string into the array pointed to by buf (which contains at least 26 bytes) and returns buf.
Unlike ctime(), the thread-safe version ctime_r() is not required to set tzname.
The ctime() function returns the pointer returned by asctime() with that broken-down time as an argument.
On successful completion, ctime_r() returns a pointer to the string pointed to by buf. When an error is encountered, a NULL pointer is returned.
No errors are defined.
Values for the broken-down time structure can be obtained by calling gmtime() or localtime(). This interface is included for compatibility with older implementations, and does not support localised date and time formats. Applications should use the strftime() interface to achieve maximum portability.
asctime(), clock(), difftime(), gmtime(), localtime(), mktime(), strftime(), strptime(), time(), utime(), <time.h>.
ctime() derived from Issue 1 of the SVID.
ctime_r() derived from the POSIX Threads Extension (1003.1c-1995).