KHTTP_EPOCH2DATETIME(3) Library Functions Manual KHTTP_EPOCH2DATETIME(3)

khttp_epoch2datetimeconvert time to components

library “libkcgi”

#include <sys/types.h>
#include <stdarg.h>
#include <stdint.h>
#include <kcgi.h>

void
khttp_epoch2datetime(int64_t epoch, int64_t *sec, int64_t *min, int64_t *hour, int64_t *mday, int64_t *mon, int64_t *year, int64_t *wday, int64_t *yday);

Format an epoch value (seconds since Jan 1, 1970, 00:00:00 UTC) into its broken-down time components. The components are filled in as follows:

sec seconds 0–59
min minutes 0–59
hour hours 0–23
day day of month 1–31
mon month 1–12
year year -2.9e11–2.9e11
yday day in year 0–365
wday day in week 0–6 (Sunday = 0)

If any of the pointers are NULL, they are ignored.

For broken-down time values suitable for struct tm, see khttp_epoch2tms(3).

khttp_datetime2epoch(3), khttp_epoch2str(3), khttp_epoch2tms(3)

Written by Kristaps Dzonsons <kristaps@bsd.lv>.

December 2, 2023 OpenBSD 7.4