KHTTP_DATETIME2EPOCH(3) Library Functions Manual KHTTP_DATETIME2EPOCH(3)

khttp_date2epoch, khttp_datetime2epochvalidate and convert date and time

library “libkcgi”

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

int
khttp_date2epoch(int64_t *res, int64_t day, int64_t mon, int64_t year, int64_t hour, int64_t min, int64_t sec);

int
khttp_datetime2epoch(int64_t *res, int64_t day, int64_t mon, int64_t year, int64_t hour, int64_t min, int64_t sec);

Convert broken-day date and time values into seconds since 00:00:00 UTC, 1970-01-01. The date and time values are accepted as UTC. () is equivalent to () but with zero hour, min, and sec arguments. If res is NULL, simply check the time values for correctness.

Date correctness means that input values fall within the following acceptable ranges:

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

The year bound is the maximum year value that may be converted to seconds for a 64-bit integer.

These deprecate (), (), (), and (), which should no longer be used.

Return zero if the given values do not correspond to a valid date and time, non-zero otherwise.

khttp_epoch2datetime(3), khttp_epoch2str(3), khttp_epoch2tms(3)

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

December 2, 2023 OpenBSD 7.4