Alternate Entry Name: _TM
B: %b/manif/t_ctrl .tm(tsptr, tlocale, timenum);
C: #include <time.h> #include <t_ctrl.h> void _tm(struct tm *tsptr, _T_locale tlocale, time_t timenum);
/* Obtain current time in Eastern Standard zone */ auto estloc, timenum, tsptr[_TM_SIZE]; estloc = .tlocale("US/EST"); timenum = .ctime(); .tm(tsptr,estloc,timenum);
.TM converts a time number into a time structure. The format of the time structure is given below, expressed in the form used by the C programming language:
struct tm { int tm_sec; /* _TM_SEC seconds (0-60) */ int tm_min; /* _TM_MIN minutes (0-59) */ int tm_hour; /* _TM_HOUR hours (0-23) */ int tm_mday; /* _TM_MDAY month day (1-31) */ int tm_mon; /* _TM_MON month (0-11) */ int tm_year; /* _TM_YEAR year - 1900 */ int tm_wday; /* _TM_WDAY day of week (0-6) */ int tm_yday; /* _TM_YDAY year day (0-365) */ int tm_isdst; /* _TM_ISDST daylight savings flag * >0 daylight time * =0 standard time * <0 Can't tell */ char *tm_zone; /* _TM_ZONE time zone name */ long tm_gmtoff; /* _TM_GMTOFF seconds from GMT * positive -> east of Greenwich */ };
This format is useful for extracting pieces of date/time information. It can also be passed to the .TMFMT function to be formatted into a variety of date/time string formats. The names like _TM_SEC, that shown above are the names of B manifests defined in B/MANIF/T_CTRL that can be used to access these fields. The manifest _TM_SIZE is also supplied to give the B size of a vector to hold a time structure.
The "tm_zone" field in a "tm" structure is always a 36-bit machine pointer, with the word offset in the upper half of the word and a character offset/segment number in the lower half. Thus it has the format of a C pointer, not a B pointer. If necessary, you can pass this pointer to "printf" to print out the time zone name. If you must get a copy of the string, you can pass the pointer to CONCAT.
Copyright © 1996, Thinkage Ltd.