A pointer to a `struct tm`, which represents a broken-down calendar time. The structure contains fields such as year, month, day, hour, minute, and second for representing human-readable time.
1st Parameter
Pointer to a `struct tm` representing a broken-down local time. The fields are adjusted and normalized by the function.
Read more about parameters of mktime in parameters section
The mktimefunction in C language Converts a time structure to calendar time.
The mktime function converts a local time, expressed as a struct tm, into a calendar time value of type time_t. The function also normalizes the contents of the struct tm, so that each member is in the correct range.
The mktimefunction takes 1
parameter:
•
struct tm * `timeptr`: Pointer to a `struct tm` representing a broken-down local time. The fields are adjusted and normalized by the function.
Converts the broken-down local time represented by `timeptr` into a `time_t` value, which represents the time in seconds since the epoch (00:00:00 UTC, January 1, 1970). Normalizes the fields of the `struct tm` and modifies it to reflect the local time. Returns the `time_t` value, or `(time_t)-1` if the time cannot be represented.
The mktime function return value :
Returns the calendar time encoded as a time_t value, or (time_t)(-1) if the time cannot be represented
Output
This example demonstrates basic usage of mktime to convert a struct tm to a time_t value.