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โ]
Expression | Return type | Operational 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:
TC satisfies the Clock requirements,
the types TCโ::โrep, TCโ::โduration, and TCโ::โtime_ยญpoint satisfy the requirements of EqualityComparable, LessThanComparable, DefaultConstructible, CopyConstructible, CopyAssignable, Destructible, and the requirements of numeric types. [โNote: This means, in particular, that operations on these types will not throw exceptions. โโโend noteโ]
lvalues of the types TCโ::โrep, TCโ::โduration, and TCโ::โtime_ยญpoint are swappable,
the function TCโ::โnow() does not throw exceptions, and
the type TCโ::โtime_ยญpointโ::โclock meets the TrivialClock requirements, recursively.