I'm aware of steady_clock
and that it is the only clock that is specified to be monotonic. And I understand that system_clock
can jump forward or backward due to daylight savings and leap years. But doesn't count()
give you the number of ticks of the system clock since the Unix epoch, which is an always increasing number, regardless of how that integer number of ticks is parsed into a "calendar date + wall clock" interpretation? i.e. Even if the "calendar date + wall clock" jumps from 2am from 3am on a given day in March, hasn't the integer count of ticks only increased by one tick?
In short, doesn't it stand to reason that the value of std::chrono::system_clock.now().time_since_epoch().count()
should be expected to, in the short term, increase monotonically (barring updates to the system clock, which of course are a very real event), even if the date+time it refers to jumps around?
EDIT
As pointed out by @SergeyA, if the system clock is changed, then of course the value will jump around. But I think the change in wall clock time due to daylight savings is not an NTP update event or a manual change by a user. If it helps clarify the question, I'm interested in uptimes of an hour or two, which could cross the DST boundary, as opposed to uptimes of weeks or months, in which the clock could drift.