MKTIME - convert time structure to time number.

(ANSI Standard)

Usage:

#include <time.h>
timenum = mktime(timeptr);

Where:

struct tm *timeptr;
points to a time structure as generated by "localtime".
time_t timenum;
is the corresponding time number.

Description:

"mktime" converts a time structure into a time number and returns this number. The lay-out of a time structure is given in "expl c lib localtime".

The time structure is assumed to give a time in the local time zone. This means that the time zone information in the time structure is always ignored.

The time structure whose address is passed to "mktime" does not have to conform to the usual restrictions on time structures. The "tm_wday" and "tm_yday" elements are ignored as input, and therefore do not have to agree with the date as given by other elements in the structure. Similarly, other elements in the structure are not subject to their usual range restrictions; for example, "tm_mon" can be outside the range 0 through 11.

When "mktime" is passed a pointer to a time structure that does not conform to the usual restrictions, it converts the elements in the structure so that they DO conform. For example, if the structure refers to December 32 of some year, the elements are changed to refer to January 1 of the next year. In such cases, "tm_mday" is not set until "tm_mon" and "tm_year" have been finalized.

The "tm_wday" and "tm_yday" elements are also adjusted if necessary. In this way, "mktime" can be used to determine the day of the week on which a particular date falls.

See Also:

expl c lib localtime
For a description of the "tm" struct.
expl c lib time
 
expl c time
 

Copyright © 1996, Thinkage Ltd.