safec
3.0
Safe C Library - ISO TR24731 Bounds Checking Interface
|
#include "safe_lib.h"
Functions | |
EXPORT errno_t | ctime_s (char *dest, rsize_t dmax, const time_t *timer) |
The ctime_s function converts the given time since epoch to a calendar local time and then to a textual representation, as if by calling asctime_s(buffer, bufsz, localtime_s(time, &(struct tm){0})) . More... | |
EXPORT errno_t ctime_s | ( | char * | dest, |
rsize_t | dmax, | ||
const time_t * | timer | ||
) |
The ctime_s
function converts the given time since epoch to a calendar local time and then to a textual representation, as if by calling asctime_s(buffer, bufsz, localtime_s(time, &(struct tm){0}))
.
The message is copied into the user-provided dest
buffer, which is guaranteed to be null-terminated.
No more than dmax-1 bytes are written, the buffer is always null-terminated. The function does not support localization. Uses the re-entrant ctime_r()
if available.
[out] | dest | pointer to a user-provided buffer. |
[in] | dmax | restricted maximum length of dest |
[in] | timer | pointer to a epoch (long, seconds since 1970) |
EOK | on success |
ESNULLP | when dest or tm is a NULL pointer |
ESLEMAX | when dmax > RSIZE_MAX_STR |
ESLEMIN | when dmax < 26 or *timer < 0 |
ESLEMAX | when *timer > 313360441200L, the year 10000, resp. LONG_MAX on 32bit systems |
ESNOSPC | when dmax is too small for the result buffer |
-1 | when ctime_r or ctime returned NULL |