(ANSI Standard)
#include <time.h> loctim = localtime(clock);
"localtime" expands a time number into a structure containing a number of integers giving time values. The structure includes the following elements:
struct tm { /* ANSI standard fields */ int tm_sec; /* 0 to 60 */ int tm_min; /* 0 to 59 */ int tm_hour; /* 0 to 23 */ int tm_mday; /* 1 to 31 */ int tm_mon; /* 0 to 11 */ int tm_year; /* year - 1900 */ int tm_wday; /* Sunday = 0 */ int tm_yday; /* 0 to 365 */ int tm_isdst; /* >0 if Daylight Savings Time, * 0 if Standard, * <0 if unknown */
/* extensions to ANSI standard */ char *tm_zone; /* time zone name */ long tm_gmtoff; /* offset from GMT */ };
In this way, you can obtain any particular component of the date or time.
The C library determines GMT using the time zone definition file of the UW Tools package. For further information, see "expl b tz".
Calls to other date/time functions may indirectly change values in the "tm" structure indicated by the "loctim" pointer.
Copyright © 1996, Thinkage Ltd.