45 lines
1.5 KiB
Groff
45 lines
1.5 KiB
Groff
|
|
NAME
|
|
ctime, localtime, gmtime, asctime - convert date and
|
|
time to string
|
|
SYNTAX
|
|
#include <time.h>
|
|
char *ctime (clock)
|
|
long *clock;
|
|
struct tm *gmtime (clock)
|
|
long *clock;
|
|
char *asctime (tm)
|
|
struct tm *tm;
|
|
DESCRIPTION
|
|
Ctime converts a long integer, pointed to by clock,
|
|
representing the time in seconds since 00:00:00 GMT, January
|
|
1, 1970, and returns a pointer to a 26-character string in
|
|
the following form. All the fields have constant width.
|
|
Sun Sep 16 01:03:52 1973\n\0
|
|
Gmtime returns a pointer to a ``tm'' structure,
|
|
described below. Gmtime converts directly to Greenwich
|
|
Mean Time (GMT), which is the time the UNIX system uses.
|
|
Asctime converts a ``tm'' structure to a 26-character
|
|
string, as shown in the above example, and returns a pointer
|
|
to the string.
|
|
Declarations of all the functions and externals, and the
|
|
``tm'' structure, are in the <time.h> header file. The
|
|
structure declaration is:
|
|
struct tm {
|
|
int tm_sec; /* seconds (0 - 59) */
|
|
int tm_min; /* minutes (0 - 59) */
|
|
|
|
int tm_hour; /* hours (0 - 23) */
|
|
int tm_mday; /* day of month (1 - 31) */
|
|
int tm_mon; /* month of year (0 - 11) */
|
|
int tm_year; /* year - 1900 */
|
|
int tm_wday; /* day of week (Sunday = 0) */
|
|
int tm_yday; /* day of year (0 - 365) */
|
|
};
|
|
SEE ALSO
|
|
time(2).
|
|
BUGS
|
|
The return values point to static data whose content is
|
|
overwritten by each call.
|
|
|