package windtrap

  1. Overview
  2. Docs

Module ClockSource

Monotonic clock for timing tests.

Provides access to a monotonic clock suitable for measuring elapsed time. Unlike wall-clock time, monotonic time never goes backwards and is unaffected by system time adjustments.

Derived from mtime.

Sourcetype counter

An opaque value representing a point in monotonic time. Use with count or count_s to measure elapsed time.

Sourceval counter : unit -> counter

counter () samples the current monotonic time.

Sourceval count : counter -> int64

count start returns the elapsed nanoseconds since start. The result is always non-negative.

Sourceval count_s : counter -> float

count_s start returns the elapsed seconds since start as a float. The result is always non-negative.