Guardian Native C Library Calls Reference Manual (G06.28+, H06.04+)

Guardian Native C Library Calls (j - m) mktime(3)
NAME
mktime - Converts broken-down time into time since the Epoch
LIBRARY
G-series native Guardian processes: $SYSTEM.SYSnn.ZCRTLSRL
G-series native OSS processes: /G/system/sysnn/zcrtlsrl
H-series native Guardian processes: $SYSTEM.ZDLLnnn.ZCRTLDLL
H-series OSS processes: /G/system/zdllnnn/zcrtldll
SYNOPSIS
#include <time.h>
time_t mktime(
struct tm *timeptr
);
PARAMETERS
timeptr Points to a type tm structure that contains the broken-down time.
DESCRIPTION
The mktime() function converts the broken-down time, expressed as local time, in the type tm
structure pointed to by the timeptr parameter, into a time since the Epoch in the same format as
the values returned by the time( ) function. The original values of members timeptr->tm_wday
and timeptr->tm_yday of the structure are ignored, and the original values of other members of
the structure are not restricted to the ranges dened in the time.h header le. The range [0, 61]
for structure member tm_sec allows for an occasional leap second or double leap second.
A positive or 0 (zero) value for member tm_isdst tells the mktime() function whether daylight-
saving time is in effect. A negative value for tm_isdst tells the mktime() function to nd out
whether daylight-saving time is in effect for the specied time. Local timezone information is
set as though the tzset() function were called.
On successful completion, values for the timeptr->tm_wday and timeptr->tm_yday members of
the structure are set, and the other members are set to specied times since the Epoch, but with
their values forced to the ranges previously indicated; the nal value of timeptr->tm_mday is not
set until the values of members timeptr->tm_mon and timeptr->tm_year are determined.
The tm structure is dened in the time.h header le.
EXAMPLES
This example nds the date 1000 days from now:
#include < timeh>
#include < stdioh>
struct tm *timeptr;
time_t now, later;
int main(void)
{
now = time(NULL);
timeptr = localtime(&now);
timeptr -> tm_mday += 1000;
later = mktime(timeptr);
printf("\n1000 days from now: %s\n", ctime(&later));
}
527192-005 Hewlett-Packard Company 455