INtime SDK Help
mktime, _mktime32, _mktime64

Converts the time/date structure into a fully defined structure with normalized values and then converts it to calendar time.

#include <time.h>

time_t mktime (struct tm *timedate);
        
__time32_t _mktime32(struct tm *timedate);

__time64_t _mktime64(struct tm *timedate);

Parameters

timedate
Time/date structure, TM, possibly incomplete.

Remarks

The converted time has the same encoding as the values returned by time.

The elements of the tm structure contain the values described in time.h.

The original values of the tm_wday and tm_yday components in tm, and the original values of the other components are not restricted to their normal ranges. If successful, mktime sets the values of tm_wday and tm_yday appropriately, and sets the other components to represent the specified calendar time, but with their values forced to the normal ranges; the final value of tm_mday is not set until tm_mon and tm_year are determined.

gmtime and localtime use a single statically allocated buffer for the conversion. If you supply this buffer to mktime, it destroys the previous contents.

A positive or zero value for tm_isdst causes mktime() to presume initially that summer time (for example, Daylight Saving Time) is or is not in effect for the specified time, respectively. A negative value for tm_isdst causes the mktime() function to attempt to divine whether summer time is in effect for the specified time.

mktime() is a wrapper for _mktime32() and time_t is, by default, equivalent to __time32_t. If you need to force the compiler to interpret time_t as the new 64-bit _time64_t, you can define _USE_64BIT_TIME_T. This is recommended to ensure that your application does not fail after January 18, 2038, but is not backwards-compatible with previous versions of INtime.

Return Values

The specified calendar time encoded as a time_t.
Success.
  • -1 cast as type time_t if the calendar time cannot be represented.
  • -1 if timedate references a date before epoch time.
Failure.

Requirements

Versions Defined in Include Link to
INtime 3.0
INtime 6.0 (64-bit support)
intime/rt/include/time.h time.h clib.lib

 

See Also