BuildkiteTestCollector.Instant (buildkite_test_collector v0.3.1)
Represents a single instant with microsecond accuracy.
Wraps monotonic time to ensure that there are no unit mistakes.
Why not just use DateTime
instead?
Sadly, the wall clock time can move backwards and forwards between samples (for example if NTP is updating the clock, or during a daylight savings transition). The system monotonic clock always moves forwards, regardless of the current wall clock time. This means it's no good for measuring the absolute time, but is perfect for measuring relative time.
See erlang:monotonic_time/0 for more information.
Summary
Functions
Add a duration to an instant and return a new instant.
Return an instant representing "now" as understood by the system's monotonic clock.
Types
@type t() :: %BuildkiteTestCollector.Instant{usec: integer()}
Functions
@spec add(t(), BuildkiteTestCollector.Duration.t()) :: t()
Add a duration to an instant and return a new instant.
@spec now() :: t()
Return an instant representing "now" as understood by the system's monotonic clock.