Open
Description
Headers need to use a well-defined timestamp format: https://www.rfc-editor.org/rfc/rfc2616#section-3.3
E.g. Wed, 21 Oct 2015 07:28:00 GMT
Dream can already print to this format:
Line 54 in 0826c26
It would be good to provide support in Dream itself for printing and parsing this format as other headers also need to use it, e.g.
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Last-Modified
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Modified-Since
Maybe an API like:
val timestamp : ?epoch_s:float -> unit -> string
(** [timestamp ?epoch_s] () is a string representation of [epoch_s] (epoch
seconds) if provided, else the current timestamp. *)
val of_timestamp : string -> (float, string) result
(** [of_timestamp str] is the time in epoch seconds parsed from the [str]
representation, or an error message if parse failed. *)