Converting dates to epoch times

Is there a more concise way to convert a Date to epoch time than:

toEpochTime d = convertRelTimeToMicroseconds $ subTime (dateToTime d) epoch

epoch = dateToTime $ date 1970 Jan 1 

dateToTime d = time d 0 0 0

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, timeToMicrosecondsSinceEpoch currently exists from DA.Internal.Time, but as the module name suggests, if you use it and your program breaks, you get to keep both pieces.

Is it problematic to add timeToMicrosecondsSinceEpoch to the public API?

I think it’s problematic. Maybe someone else feels differently.