chsvlib
chsv helper source code

◆ localtime()

int Chusov::localtime ( const time_t *restrict  tp,
struct tm *restrict  pResult 
)
noexcept

Converts time passed since the epoch on the target machine and specified as a time_t variable into local calendar 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 local calendar 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 localtime 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 localtime_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 localtime_s at all. Also, in case of an error, the standard implementation set up errno code rather than return it.

See also
gmtime.