chsvlib
chsv helper source code

◆ gmtime()

int Chusov::gmtime ( const std::time_t *restrict  tp,
std::tm *restrict  pResult 
)
noexcept

Converts time passed since the epoch on the target machine and specified as a time_t variable into calendar UTC time expressed by an object of the type tm.

Parameters
[in]tpA pointer to an object specifying time passed since epoch on the target machine.
[out]pResultA pointer to a buffer which receives a tm object specifying calendar UTC time.
Returns
A POSIX error code resulting from the operation, i.e. zero on success and a nonzero value on failure.

The function behaves as specified for the gmtime by the C and C++ standards except that it writes the result into the output buffer pointed to by pResult rather than a global buffer. The standard gmtime_s function does the same thing, though the Microsoft implementation of the standard library has an interface that does not conform to the standard, and other implementations (such as Linux) may not provide gmtime_s at all. Also, in case of an error, the standard implementation set up errno code rather than return it.

See also
localtime.