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.
A pointer to a constant `time_t` object, representing time as the number of seconds since the epoch (00:00:00 UTC, January 1, 1970). The data it points to cannot be modified.
1st Parameter
Pointer to a `time_t` object representing the time in seconds since the epoch
Read more about parameters of gmtime in parameters section
The gmtimefunction in C language Converts the calendar time to broken-down time representation.
The gmtime function converts the calendar time pointed to by timer into a broken-down time representation, expressed as Coordinated Universal Time (UTC). The result is stored in a statically allocated structure which may be overwritten by subsequent calls to gmtime or localtime.
The gmtimefunction takes 1
parameter:
•
const time_t * `timer`: Pointer to a `time_t` object representing the time in seconds since the epoch
Converts the time value pointed to by `timer` into Coordinated Universal Time (UTC), expressed as a `struct tm`. Returns a pointer to a statically allocated `struct tm` which represents the broken-down time.
The gmtime function return value :
Returns a pointer to the resulting struct tm, or NULL if an error occurred
Output
This example demonstrates how to use gmtime to get the current UTC time.