KHTTP_DATETIME2EPOCH(3)

πŸ“¦ version 1.0.1, in alpine 3.24

πŸ’– NAME πŸ’–

okay so bestie, welcome to the KHTTP_DATETIME2EPOCH(3) page from the Library Functions Manual πŸ’…βœ¨

khttp_date2epoch, khttp_datetime2epoch β€” validate and convert date and time. Periodt.

πŸŽ€ LIBRARY πŸŽ€

This one lives in library libkcgi. Slay.

✨ SYNOPSIS ✨

#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);

🌸 DESCRIPTION 🌸

okay so these functions 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. khttp_date2epoch() is equivalent to khttp_datetime2epoch() but with zero hour, min, and sec arguments. If res is NULL, it simply checks the time values for correctness β€” just a vibe check, no cap.

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. big number energy, fr fr.

These deprecate kutil_date2epoch(), kutil_date_check(), kutil_datetime2epoch(), and kutil_datetime_check(), which should no longer be used. do not use the old ones, bestie β€” they’re deprecated.

πŸ”₯ RETURN VALUES πŸ”₯

Return zero if the given values do not correspond to a valid date and time, non-zero otherwise. 0 means invalid, non-zero means valid β€” don’t flip it.

πŸ¦‹ SEE ALSO πŸ¦‹

πŸ‘‘ AUTHORS πŸ‘‘

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

mwah πŸ’‹ β€” source/version: Debian, date: $Mdocdate$, page name: KHTTP_DATETIME2EPOCH(3). that’s the whole page, bestie 🌈

πŸ“¦ where this page comes from
  • alpine 3.24: kcgi-doc 1.0.1-r0 Β· ISC
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms