std1.0.0-beta-7 SafeC docs

Module http::date

#include <std/http/date.h> source

HTTP dates (RFC 9110 §5.6.7).

The Date, Last-Modified, Expires, If-Modified-Since and Retry-After headers (and cookies' Expires attribute) carry timestamps as "IMF-fixdate" text: "Sun, 06 Nov 1994 08:49:37 GMT". Times here are Unix seconds (UTC), the same scale as std::time_now() (std/time.h). Pure arithmetic — no libc time functions, no time zone database.

Functions

http_date_formatIMF-fixdate for 'unix_seconds' (UTC). Years before 1 or after 9999 are clamped into that range.
http_date_parseParses any of the three formats RFC 9110 requires recipients to accept: IMF-fixdate ("Sun, 06 Nov 1994 08:49:37 GMT"), the obsolete RFC 850 form ("Sunday, 06-Nov-94 08:49:37 GMT", two-digit years mapped to the nearest 50-year window) and asctime ("Sun Nov 6 08:49:37 1994"). The weekday name is not checked against the date. *ok = 0 (and 0 returned) on anything else.
http_date_nowThe current time as an IMF-fixdate (hosted targets: std::time_now()).
http_days_from_civilDays since 1970-01-01 for a proleptic-Gregorian civil date (month 1-12), and back — the conversions the two functions above are built on.
http_civil_from_days