23 General utilities library [utilities]

23.17 Time utilities [time]

23.17.3 Clock requirements [time.clock.req]

A clock is a bundle consisting of a duration, a time_ยญpoint, and a function now() to get the current time_ยญpoint. The origin of the clock's time_ยญpoint is referred to as the clock's epoch. A clock shall meet the requirements in Table 52.

In Table 52 C1 and C2 denote clock types. t1 and t2 are values returned by C1โ€‹::โ€‹now() where the call returning t1 happens before the call returning t2 and both of these calls occur before C1โ€‹::โ€‹time_ยญpointโ€‹::โ€‹max(). [โ€‰Note: This means C1 did not wrap around between t1 and t2. โ€‰โ€”โ€‰end noteโ€‰]

Table 52 โ€” Clock requirements
ExpressionReturn typeOperational semantics
C1โ€‹::โ€‹rep An arithmetic type or a class emulating an arithmetic type The representation type of C1โ€‹::โ€‹duration.
C1โ€‹::โ€‹period a specialization of ratio The tick period of the clock in seconds.
C1โ€‹::โ€‹duration chronoโ€‹::โ€‹duration<C1โ€‹::โ€‹rep, C1โ€‹::โ€‹period> The duration type of the clock.
C1โ€‹::โ€‹time_ยญpoint chronoโ€‹::โ€‹time_ยญpoint<C1> or chronoโ€‹::โ€‹time_ยญpoint<C2, C1โ€‹::โ€‹duration> The time_ยญpoint type of the clock. C1 and C2 shall refer to the same epoch.
C1โ€‹::โ€‹is_ยญsteady const bool true if t1 <= t2 is always true and the time between clock ticks is constant, otherwise false.
C1โ€‹::โ€‹now() C1โ€‹::โ€‹time_ยญpoint Returns a time_ยญpoint object representing the current point in time.

[โ€‰Note: The relative difference in durations between those reported by a given clock and the SI definition is a measure of the quality of implementation. โ€‰โ€”โ€‰end noteโ€‰]

A type TC meets the TrivialClock requirements if: