[Python-Dev] this is why we shouldn't call it a "monotonic clock" (was: PEP 418 is too divisive and confusing and should be postponed)
cs at zip.com.au
Fri Apr 6 05:36:20 CEST 2012
On 05Apr2012 21:07, Zooko Wilcox-O'Hearn <zooko at zooko.com> wrote:
| On Thu, Apr 5, 2012 at 7:14 PM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
| > This is the strict mathematical meaning of the word "monotonic",
| > but the way it's used in relation to OS clocks, it seems to mean rather
| > more than that.
| Yep. As far as I can tell, nobody has a use for an unsteady, monotonic clock.
Well, not for a wildly unsteady monotonic clock.
| There seem to be two groups of people:
| 1. Those who think that "monotonic clock" means a clock that never
| goes backwards.
I will always fall into this category.
| These people are in the majority. After all, that's
| what the word "monotonic" means ¹ . However, a clock which guarantees
| *only* this is useless.
Sure. I wouldn't have much use for a clock that was only monotonic, but
the word "clock" implies a bit more all on its own, so I am undisturbed.
| 2. Those who think that "monotonic clock" means a clock that never
| jumps, and that runs at a rate approximating the rate of real time.
If they're calling it "monotonic" on that basis alone, they are
wrong. Pure and simple.
| This is a very useful kind of clock to have! It is what C++ now calls
| a "steady clock". It is what all the major operating systems provide.
Sure. So _call_ it a steady clock!
| The people in class 1 are more correct, technically, and far more
| numerous, but the concept from 1 is a useless concept that should be
| So before proceeding, we should mutually agree that we have no
| interest in implementing a clock of type 1. It wouldn't serve anyone's
| use case (correct me if I'm wrong!) and the major operating systems
| don't offer such a thing anyway.
Bah! They are not disjoint sets of clocks!
Linux' CLOCK_MONOTONIC_RAW is both type 1 and type 2.
| Then, if we all agree to stop thinking about that first concept, then
| we need to agree whether we're all going to use the word "monotonic
| clock" to refer to the second concept,
| or if we're going to use a
| different word (such as "steady clock") to refer to the second
| concept. I would prefer the latter, as it will relieve us of the need
| to repeatedly explain to newcomers: "That word doesn't mean what you
| think it means.".
Yes. Resorting to The Princess Bride to resolve bad terminology is only
funny in a movie, and should be a Big Clue that the term is either being
misused or too badly understood.
| The main reason to use the word "monotonic clock" to refer to the
| second concept is that POSIX does so, but since Mac OS X, Solaris,
| Windows, and C++ have all avoided following POSIX's mistake, I think
| Python should too.
No. If it is not monotonic, DO NOT CALL IT monotonic. Call it steady,
perhaps, if it _is_ steady (within some threshold of course).
But CLOCK_MONOTONIC_RAW is type 1 and 2, and is thus a "steady
monotonic" clock. Probably a good choice for both.
We can argue about what characteristics a useful clock has.
And we can argue about what characteristics the various OS clocks
But please DO NOT invent a new and misleading meaning for a well defined
word. "monotonic" alone is such a word, and means just one thing.
"monotonic clock" means _more_, but isn't always a requirement; "steady
clock" seems more commonly wanted.
Except of course that some participants say "steady clock" is a
Cameron Simpson <cs at zip.com.au> DoD#743
Politics, n. Strife of interests masquerading as a contest of principles.
- Ambrose Bierce, _The_Devil's_Dictionary_
More information about the Python-Dev