package timedesc
Module Timedesc.SpanSource
Signed/directional span of time expressed as a tuple of (s, ns)
sis the signed second of the spannsis the unsigned nanosecond offset
The actual span represented is defined as s * 10^9 + ns in nanosecond, regardless of the sign of s
Order is defined using lexicographic order, i.e. lt x y iff. x.s < y.s || (x.s = y.s && x.ns < y.ns)
Constants
Constructors
s defaults to 0L, ns defaults to 0
ns may be negative, and is normalized during construction
Interpretation of provided input is still s + ns, i.e. if you wish to represent "negative (1 second and 500 nanosecond)", then the call could look like make ~s:(-1L) ~ns:(-500)
Conversion
Returns span in seconds, fraction represents subsecond span.
Representation is the same as result from Unix.gettimeofday.
Convert from span in seconds, fraction represents subsecond span
Representation is the same as result from Unix.gettimeofday.
Comparison
Arithmetic
Rounds to nearest second
For round x
- if
x.ns >= 500_000_000, thenround x = ceil x - otherwise
round x = floor x