mktime
Defined in header <time.h>
|
||
Renormalizes local calendar time expressed as a struct tm object and also converts it to time since epoch as a time_t object. time->tm_wday
and time->tm_yday
are ignored. The values in time
are not checked for being out of range.
A negative value of time->tm_isdst
causes mktime
to attempt to determine if Daylight Saving Time was in effect in the specified time.
If the conversion to time_t
is successful, the time
object is modified. All fields of time
are updated to fit their proper ranges. time->tm_wday
and time->tm_yday
are recalculated using information available in other fields.
Parameters
time | - | pointer to a tm object specifying local calendar time to convert |
Return value
time since epoch as a time_t object on success or -1 if time
cannot be represented as a time_t object (POSIX also requires EOVERFLOW
to be stored in errno in this case).
Notes
If the struct tm object was obtained from POSIX strptime or equivalent function, the value of tm_isdst
is indeterminate, and needs to be set explicitly before calling mktime
.