|
ProtoCore v1.0.16
Deterministic, zero-heap network stack for embedded targets
|
Render a Unix epoch as an RFC 7231 IMF-fixdate. More...
#include "shared/time_compat/time_compat.h"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. | |
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.
Definition in file http_date.h.
| #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.
| void protocore_http_date_format | ( | uint8_t * | work | ) |
|
extern |
The operands and the outcome.