ctime.3c (2010 09)
c
ctime(3C) ctime(3C)
NAME
ctime(), ctime_r(), asctime(), asctime_r(), daylight(), difftime(), gmtime(), gmtime_r(), localtime(),
localtime_r(), mktime(), timezone(), tzname(), tzset() - convert date and time to string
SYNOPSIS
#include <time.h>
char *asctime(const struct tm *timeptr);
char *asctime_r(const struct tm *timeptr, char *buffer);
char *ctime(const time_t *timer);
char *ctime_r(const time_t *timer, char *buffer);
double difftime(time_t time1, time_t time0);
struct tm *gmtime(const time_t *timer);
struct tm *gmtime_r(const time_t *timer, struct tm *result);
struct tm *localtime(const time_t *timer);
struct tm *localtime_r(const time_t *timer, struct tm *result);
time_t mktime(struct tm *timeptr);
extern long timezone;
extern int daylight;
extern char *tzname[2];
void tzset(void);
DESCRIPTION
asctime() Convert the broken-down time contained in the structure pointed to by timeptr and
return a pointer to a 26-character string in the form:
Sun Sep 16 01:03:52 1973\n\0
All the fields have constant width.
asctime() returns NULL and sets errno to [ERANGE] if tm_year in timeptr is
less than 0 or is greater than 8099. In both 32-bit and 64-bit HP-UX, the minimum
date supported by asctime() is January 1 00:00:00 1900 and the maximum date
supported by asctime() is December 31 23:59:59 9999.
asctime_r() is identical to asctime(), except that it places the result in the user supplied
buffer and returns a pointer to buffer upon success. A buffer length of at least
26 is required.
ctime() Convert the calendar time pointed to by timer , representing the time in seconds since
the Epoch, and return a pointer to the local time in the form of a string. Equivalent
to:
asctime(localtime(timer))
The minimum date supported by ctime() in both 32-bit and 64-bit HP-UX is Friday
December 13 20:45:52 UTC 1901. The maximum dates supported by ctime() are
Tuesday January 19 03:14:07 UTC 2038 and Friday December 31 23:59:59 UTC 9999
in 32-bit HP-UX and 64-bit HP-UX, respectively.
In 64-bit HP-UX,
ctime() returns NULL and sets errno to [ERANGE] if timer is
less than the number of seconds that corresponds to the minimum date supported
(i.e., INT_MIN, as defined in limits.h), or exceeds the number of seconds that
corresponds to the maximum date supported.
ctime_r() is identical to ctime(), except that it places the result in the user supplied buffer
and returns a pointer to buffer upon success. A buffer length of at least 26 is
required.
difftime() Return the difference in seconds between two calendar times: time1 - time0 .
HP-UX 11i Version 3: September 2010 − 1 − Hewlett-Packard Company 1