How do robust clocks interact with time-limited bit representations?

11.20.7.2/1 begins:

The objects of the steady_clock class represent a clock for which time_point values ​​never decrease as physical time and for which time_point values ​​advance at a steady speed relative to real time. That is, the clock may not be adjusted.

In concept, this is fine, but given that there will almost certainly be a limited number of bits to represent a point in time, it is difficult to imagine an implementation where the constant value of the clock simply increases forever.

11/20/3 / 2 seems to support my lack of imagination, because it refers (in a non-normative note) to a watch that "wraps". This suggests that if I have time_point t1 and later time_point t2 taken from the same constant clock, t2 may appear ahead of time because the clock can be wrapped between t1 and t2 .

It is very difficult for me to understand the standard in this area. Can anyone give clarity about the relationship and interaction of the constant clock and the wrap of the clock?

+4
source share
1 answer

Please send an error report when you are really watching the steady_clock transition. On my system, if I do not restart the computer within the next 292 years, this will happen in 2305. Sorry if I will not answer at this time. :-)

Leaning to the side, implementation is necessary to support a sufficiently large bit length, so that clock scrolling cannot be observed during practical time. It is believed that nanoseconds in a 64-bit integer from the moment the computer boots up are one reasonable implementation of this.

+3
source

All Articles