Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the rationale for renaming monotonic_clock to steady_clock in <chrono>?

Tags:

c++

c++11

chrono

Why did the committee rename monotonic_clock to steady_clock? Vendors are providing monotonic_clock for backwards compatibility so I expect monotonic_clock will linger for a while.

It just seems a bit early to deprecate something in C++0x. ;) Edit: The committe has the right and responsibility to rename components the best they can before release as was done in this case.

I don't see the big benefit of the rename.

like image 250
emsr Avatar asked Jul 21 '11 14:07

emsr


1 Answers

N3128 is the proposal that did so and includes the rationale:

The implementation of the timeout definition necessarily depends on a steady clock, one that cannot be adjusted. A monotonic clock is not sufficient. While one could be implicit in the standard, below we make one explicit.

Given a steady clock, the monotonic clock seems to be of marginal utility, and we replace the monotonic clock with the steady clock.

monotonic_clock wasn't deprecated. It was removed prior to standardization. The draft standard is subject to change right up until it is voted to FDIS. And this is one of those changes. Living on the draft (the bleeding edge) is great, but one must accept the risks of doing so.

like image 55
Howard Hinnant Avatar answered Sep 20 '22 18:09

Howard Hinnant