Converting dates to epoch times
- asarpeshkarOP
Is there a more concise way to convert a
Dateto epoch time than:toEpochTime d = convertRelTimeToMicroseconds $ subTime (dateToTime d) epoch epoch = dateToTime $ date 1970 Jan 1 dateToTime d = time d 0 0 0 - Stephen
The Unix epoch is deemphasized in the Daml-LF primitive date/time model, which is defined in terms of RFC 3339 instead. That is, your bounds are not some power of 2 offset from Unix epoch; they are defined as dates that are intuitive to read based on the RFC 3339 textual representation.
That said,
timeToMicrosecondsSinceEpochcurrently exists fromDA.Internal.Time, but as the module name suggests, if you use it and your program breaks, you get to keep both pieces. - asarpeshkar
Is it problematic to add
timeToMicrosecondsSinceEpochto the public API? - Stephen
I think it’s problematic. Maybe someone else feels differently.