MKTIME(3C-POSIX) RISC/os Reference Manual MKTIME(3C-POSIX)
NAME
mktime - convert broken-down time into calendar time
SYNOPSIS
#include <time.h>
timet mktime(timeptr)
struct tm *timeptr;
DESCRIPTION
mktime takes the contents of the tm structure pointed to by
timeptr and converts it into calendar time (seconds since
they epoch) of the type time_t. mktime performs the oppo-
site function of localtime and gmtime.
The tm structure is defined in <time.h> and includes the
following fields:
int tm_sec; /* seconds after the minute [0-61] */
int tm_min; /* minutes after the hour [0-59] */
int tm_hour; /* hours since midnight [0-23] */
int tm_mday; /* day of the month [1-31] */
int tm_mon; /* months since January [0-11] */
int tm_year; /* year (since 1900) */
int tm_wday; /* days since Sunday [0-6] */
int tm_yday; /* days since January 1 [0-365] */
int tm_isdst; /* Daylight Savings Time flag */
mktime manipulates the tm structure as follows:
1. The contents of the structure are read; the fields
tm_wday and tm_yday are ignored.
2. The values of the other fields within the tm structure
are not restricted to the values for tm. For example,
you can increment the tm_hour field to discover the
calendar time one hour from now, even if this would make
the value of tm_hour greater than 23.
3. After the calculation is completed, the contents of the
tm structure are reset to conform to the newly calculated
calendar time. The value of tm_day is not set until
after the values of tm_mon and tm_year.
4. The calendar time is returned.
The value of tm_isdst is positive if Daylight Savings Time
is in effect, zero if Daylight Savings Time is not in
effect, and negative if the information is not available.
RETURN VALUES
Upon successful completion, mktime returns the calendar time
Printed 1/15/91 Page 1
MKTIME(3C-POSIX) RISC/os Reference Manual MKTIME(3C-POSIX)
corresponding to the contents of the tm structure indicated
by timeptr. Otherwise, mktime returns ((time_t)-1).
SEE ALSO
clock(3), times(2).
Page 2 Printed 1/15/91