package timedesc
Module Timedesc.SpanSource
Signed/directional span of time with nanosecond precision
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
Yields pair (s, ns) where
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.
ns is always >= 0 and < 1_000_000_000.
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.
Accessors
Comparison
Arithmetic
Rounds to nearest second
For round x
- if
x.ns >= 500_000_000, thenround x = ceil x - otherwise
round x = floor x