HP C/iX Library Reference Manual (30026-90004)
260 Chapter5
HP C/iX Library Function Descriptions
mktime
mktime
Converts a calendar time value of type tm to a time value in time_t.
Syntax
#include <time.h>
time_t mktime(struct tm *
timeptr
);
Parameters
timeptr
A pointer to a structure of type tm, as defined in <time.h>.
Return Values
x The value pointed to by
timeptr
, as a type time_t.
Description
The mktime function converts the broken-down time in the structure pointed to by
timeptr
into a calendar time value. The file pointed to by
timeptr
is expressed in the local
time. The return value has the same encoding as the values returned by the time function.
The original values of the tm_wday and tm_yday components of the structure (shown
below) are ignored.
A positive or zero value for tm_isdst causes the mktime function to presume initially that
Daylight Saving Time, respectively, is or is not in effect. A negative value for tm_isdst
causes the mktime function to attempt to determine whether Daylight Saving Time is in
effect for the specified time. The original values of the tm components are not restricted to
the ranges indicated below.
On successful completion, the values of the tm_wday and tm_yday components of the
structure are set appropriately. The values of the other components are set to represent
the specified calendar time, but with their values forced into valid ranges.
The final value of tm_mday is not set unless tm_mon and tm_year are determined.
The tm data structure is declared in <time.h>. The declaration is shown below:
struct tm {
int tm_sec; /* seconds after the minute (0 through 59 */
int tm_min; /* minutes after the hour (0 through 59) */
int tm_hour; /* hours since midnight (0 through 23) */
int tm_mday; /* day of the month (1 through 31) */
int tm_mon; /* month of the year (0 through 11) */
int tm_year; /* years since 1900 */
int tm_wday; /* days since Sunday (0 through 6) */
int tm_yday; /* day of the year (0 through 365) */
int tm_isdst; /* daylight savings time flag (1 = dst */
};