asctime_r(), asctime64_r() — Convert date and time to a 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 *asctime_r(const struct tm *__restrict__ tm, char *__restrict__ buf);
#define _LARGE_TIME_API
#include <time.h>

char *asctime64_r(const struct tm *__restrict__ tm, char *__restrict__ buf);

General description

The asctime_r() function converts the broken-down time in the structure pointed to by tm into a character string that is placed in the user-supplied buffer pointed to by buf (which contains at least 26 bytes) and then returns buf.

The function asctime64_r() will behave exactly like asctime_r() except it will support a structured date 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, asctime_r() returns a pointer to a character string containing the date and time. This string is pointed to by the argument buf.

If unsuccessful, asctime_r() returns NULL.

There are no documented errno values.

Related information