Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
mktime
◄Summary► ◄Example► ◄Up► ◄Contents► ◄Index► ◄Back►
────────────────────────────────────────────────────────────────────────────
The mktime function converts the time structure pointed to by
<timeptr> into a fully defined structure with "normalized" values.
Then the function converts the contents of the structure into a
time_t calendar time value. The structure at <timeptr> may be
incomplete.
The converted time has the same encoding as the values returned by
the time function. The original values of the tm_wday and tm_yday
components of the <timeptr> structure are ignored, 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. It sets the other components to represent the
specified calendar time, but their values are forced to the
normal ranges. The final value of tm_mday is not set until tm_mon
and tm_year are determined.
DOS and OS/2 do not accommodate dates prior to 1980. If <timeptr>
references a date before January 1, 1980, mktime returns -1.
Note that the gmtime and localtime functions use a single
statically allocated buffer for the conversion. If you supply this
buffer to mktime, the previous contents will be destroyed.
Return Value
The mktime function returns the specified calendar time encoded as
a value of type time_t. If the calendar time cannot be represented,
the function returns the value -1 cast as type time_t.
-♦-