Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
129 views
in Technique[技术] by (71.8m points)

c++ - What is the rationale for renaming monotonic_clock to steady_clock in <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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...