utcTime

Functions

static inline time_t normalizeUtcTime(struct tm *dateTime)

Normalize a broken-down UTC date and time without using the time zone of the computer.

The fields of the structure are adjusted to a valid calendar date and time, so that for example adding seconds to tm_sec rolls over the minutes, hours, days, and years, and tm_wday and tm_yday are set. Unlike mktime, the structure is interpreted as UTC and not as local time. mktime shifts the hour by one when the daylight saving flag left in the structure by an earlier call does not match the date, which happens when a date is advanced across a daylight saving transition on a computer whose time zone has one.

Parameters:

dateTime – [in,out] broken-down UTC date and time, normalized in place; tm_isdst is set to 0

Returns:

the time in seconds since 1970-01-01 00:00:00 UTC, or -1 if it cannot be represented