ctime_r(), ctime64_r() — Convert time value to date and time character string

Standards

Standards / Extensions C or C++ Dependencies

Single UNIX Specification, Version 2
Single UNIX Specification, Version 3
Language Environment®

both OS/390 V2R8

Format

#define _XOPEN_SOURCE 500
#include <time.h>

char *ctime_r(const time_t *clock, char *buf);
#define _LARGE_TIME_API
#include <time.h>

char  *ctime64_r (const time64_t *clock, char *buf);

General description

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 function ctime64_r() will behave exactly like ctime_r() except it will convert a time64_t value pointing to a calendar time beyond 03:14:07 UTC on January 19, 2038 with a limit of 23:59:59 UTC on December 31, 9999.

Returned value

If successful, ctime_r() returns a pointer to the string pointed to by buf.

If unsuccessful, ctime_r() returns a NULL pointer.

There are no documented errno values.

Related information