Converts a local-time structure to a time, in seconds, since the Epoch. Format #include <time.h> time_t mktime (struct tm *timeptr);
1 – Function Variants
Compiling with the _DECC_V4_SOURCE and _VMS_V6_SOURCE feature- test macros defined enables a local-time-based entry point to the mktime function that is equivalent to the behavior before OpenVMS Version 7.0.
2 – Argument
timeptr A pointer to the local-time structure.
3 – Description
The mktime function converts a local-time structure (struct tm) pointed to by timeptr, to a time in seconds since the Epoch (a time_t variable), in the same manner as the values returned by the time function. The original values of the tm_wday and tm_yday components of the structure are ignored, and the original values of the other components are not restricted to the ranges defined in <time.h>. Upon successful completion, the tm_wday and tm_yday components of the structure are set appropriately, and the other components are set to represent the specified time, with their values forced to the normal range. If the local time cannot be encoded, then mktime returns the value (time_t)(-1). The time_t type is defined in the <time.h> header file as follows: typedef unsigned long int time_t; Local time-zone information is set as if mktime called tzset. If the tm_isdst field in the local-time structure pointed to by timeptr is positive, mktime initially presumes that Daylight Savings Time (DST) is in effect for the specified time. If tm_isdst is 0, mktime initially presumes that DST is not in effect. If tm_isdst is negative, mktime attempts to determine whether or not DST is in effect for the specified time.
4 – Return Values
x The specified calendar time encoded as a value of type time_t. (time_t)(-1) If the local time cannot be encoded. Be aware that a return value of (time_t)(-1) can also represent the valid date: Sun Feb 7 06:28:15 2106.