daypack-dev / timere

OCaml date time handling and reasoning suite
MIT License
68 stars 7 forks source link

Restructure timestamp type maybe #30

Closed darrenldl closed 2 years ago

darrenldl commented 3 years ago

@gasche #29 reminded me that Ptime has explicit construction from Span.t to timestamp:

val of_span : span -> t option

of_span d is the POSIX time stamp that:

    Happens at the POSIX span d after Ptime.epoch if d is positive.
    Happens at the POSIX span d before Ptime.epoch if d is negative.

None is returned if the timestamp is not in the range [Ptime.min;Ptime.max].

and I wonder if Timere should follow that as well instead of what is right now type timestamp = Span.t and failing with Invalid_argument when out of range?

gasche commented 3 years ago

Relatedly: if there is a correspondence between timestamp and float, I would have maybe expected to find it in the Timestamp module. Instead it's in Date_time ({to,of}_timestamp_float) with also bits of logic in Span (which I didn't think of looking at).

darrenldl commented 2 years ago

Addressed with timedesc 0.8.0