AT&T UNIX™PC Unix System V Users Manual - tenox

AT&T UNIX™PC Unix System V Users Manual - tenox AT&T UNIX™PC Unix System V Users Manual - tenox

01.01.2013 Views

CTIME ( 3C ) CTIME ( 3C ) NAME ctime, localtime, gmtime, asctime, tzset - convert date and time to string SYNOPSIS #include char •ctime {clock) long •clock; struct tm •Iocaltime {clock) long •clock; struct tm •gmtime (clock) long •clock; char •asctime (tm) struct tm •tm; extern long timezone; extern int daylight; extern char •tzname[2]; void tzset ( ) 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 Localtime and gmtime return pointers to "tm" structures, described below. Localtime corrects for the time zone and possible Daylight Savings Time; 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 header file. The structure declaration is: struct tm { int tm_sec; I* seconds (0 - 59) *I int tm_min; I* minutes (0 - 59) *I int tm_hour; I* hours (0 -23) *I int tm_mday; I* day of month (1 - 31) *I int tm_mon; I* month of year (0 - 11) *I int tm_year; I* year - 1900 *I int tm_wday; I* day of week (Sunday = 0) *I int tm_yday; I* day of year (0 - 365) *I int tm_isdst; }; Tm_isdst is non-zero if Daylight Savings Time is in effect. - 1 -

CTIME ( 3C ) CTIME ( 3C )<br />

NAME<br />

ctime, localtime, gmtime, asctime, tzset - convert date and time<br />

to string<br />

SYNOPSIS<br />

#include <br />

char •ctime {clock)<br />

long •clock;<br />

struct tm •Iocaltime {clock)<br />

long •clock;<br />

struct tm •gmtime (clock)<br />

long •clock;<br />

char •asctime (tm)<br />

struct tm •tm;<br />

extern long timezone;<br />

extern int daylight;<br />

extern char •tzname[2];<br />

void tzset ( )<br />

DESCRIPTION<br />

Ctime converts a long integer, pointed to by clock, representing<br />

the time in seconds since 00:00:00 GMT, January 1, 1970, and<br />

returns a pointer to a 26-character string in the following form.<br />

All the fields have constant width.<br />

Sun Sep 16 01:03:52 1973\n\0<br />

Localtime and gmtime return pointers to "tm" structures,<br />

described below. Localtime corrects for the time zone and possible<br />

Daylight Savings Time; gmtime converts directly to<br />

Greenwich Mean Time (GMT), which is the time the UNIX system<br />

uses.<br />

Asctime converts a "tm" structure to a 26-character string, as<br />

shown in the above example, and returns a pointer to the string.<br />

Declarations of all the functions and externals, and the "tm"<br />

structure, are in the header file. The structure<br />

declaration is:<br />

struct tm {<br />

int tm_sec; I* seconds (0 - 59) *I<br />

int tm_min; I* minutes (0 - 59) *I<br />

int tm_hour; I* hours (0 -23) *I<br />

int tm_mday; I* day of month (1 - 31) *I<br />

int tm_mon; I* month of year (0 - 11) *I<br />

int tm_year; I* year - 1900 *I<br />

int tm_wday; I* day of week (Sunday = 0) *I<br />

int tm_yday; I* day of year (0 - 365) *I<br />

int tm_isdst;<br />

};<br />

Tm_isdst is non-zero if Daylight Savings Time is in effect.<br />

- 1 -

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!