mktime

Converts a local-time structure into time since the Epoch.

Format

#include  <time.h>

time_t mktime  (struct tm *timeptr);
Function Variants Compiling with the _DECC_V4_SOURCE and _VMS_V6_SOURCE feature- test macros defined enables a local-time-based entry point to this function that is equivalent to the behavior before OpenVMS Version 7.0.

Argument

timeptr
A pointer to the local time structure.

Description

This function converts the local-time structure, pointed to by timeptr, to a time in seconds since the Epoch in the same manner as the values returned by the time function. 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.

Return Values
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. 


Previous Page | Next Page | Table of Contents | Index