Guardian Native C Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)
mktime(3) Guardian Native C Library Calls Reference Manual
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 and J-series native Guardian processes: $SYSTEM.ZDLLnnn.ZCRTLDLL
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zcrtldll
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/ycrtldll
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 defined in the time.h header file. 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 find out
whether daylight-saving time is in effect for the specified 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 specified times since the Epoch, but with
their values forced to the ranges previously indicated; the final 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 defined in the time.h header file.
EXAMPLES
This example finds 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));
}
4−108 Hewlett-Packard Company 527192-018