ProtoCore v1.0.16
Deterministic, zero-heap network stack for embedded targets
Loading...
Searching...
No Matches
http_date.h File Reference

Render a Unix epoch as an RFC 7231 IMF-fixdate. More...

Go to the source code of this file.

Classes

struct  HttpDateArgs
 The instant a format renders, and where it lands. More...
 
struct  HttpDateVars
 
struct  HttpDateNs
 The entries. More...
 

Macros

#define PROTOCORE_HTTP_DATE_MAX   30
 Smallest buffer that holds an RFC 7231 IMF-fixdate plus its NUL.
 

Functions

void protocore_http_date_format (uint8_t *work)
 

Variables

HttpDateVars HttpDateV
 The operands and the outcome.
 

Detailed Description

Render a Unix epoch as an RFC 7231 IMF-fixdate.

One formatter serves every header that carries a timestamp (Date, Last-Modified, Expires), so the wire rendering is fixed in one place. The break-down is reentrant (gmtime_r, never the shared static tm), which is what makes it callable from any worker.

Every rejection - no epoch, no buffer, a time that will not break down - returns 0 and leaves out an empty string, so a caller that ignores the length still emits a well-formed header value rather than whatever the buffer held.

Author
Douglas Quigg (dstroy0)
Date
2026

Definition in file http_date.h.

Macro Definition Documentation

◆ PROTOCORE_HTTP_DATE_MAX

#define PROTOCORE_HTTP_DATE_MAX   30

Smallest buffer that holds an RFC 7231 IMF-fixdate plus its NUL.

Sun, 06 Nov 1994 08:49:37 GMT is 29 characters and the format is fixed-width, so this is a property of the protocol rather than a tuning choice. A smaller buffer truncates silently, because the builder writes nothing and reports 0 when the result does not fit.

Definition at line 32 of file http_date.h.

Function Documentation

◆ protocore_http_date_format()

void protocore_http_date_format ( uint8_t *  work)

Variable Documentation

◆ HttpDateV

HttpDateVars HttpDateV
extern

The operands and the outcome.