-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Instant is monotonically nondecreasing #43756
Conversation
We don't want to guarantee that `Instant::now() != Instant::now()` is always true since that depends on the speed of the processor and the resolution of the clock.
r? @brson (rust_highfive has picked a reviewer for you, use r? to override) |
Mathematically speaking, "monotonically increasing" already means x ≥ y ⇒ f(x) ≥ f(y), what you are thinking is "strictly increasing". |
@kennytm actually "strictly increasing" is: "Monotonically increasing" (or "nondecreasing") however is: |
@scalexm Thanks, updated the arrow. |
Ah right - I think only the second fix is needed then. |
Er, actually, I think the first change is still correct - Wolfram defines "monotonic function" as "A monotonic function is a function which is either entirely nonincreasing or nondecreasing." (http://mathworld.wolfram.com/MonotonicFunction.html), so Instant is monotonic, but not monotonically increasing, which is defined as "Always increasing; never remaining constant or decreasing." (http://mathworld.wolfram.com/MonotoneIncreasing.html) |
@sfackler From my understanding of english terminology, "monotonically increasing" or simply "increasing" usually means "strictly increasing", but sometimes it can just mean "nondecreasing", depending on authors and contexts. So I think you should indeed stick with "monotonically nondecreasing" which is unambiguous. But anyway the second fix is the most important since "greater" indeed means "strictly greater" with standard terminology. |
src/libstd/time/mod.rs
Outdated
/// Opaque and useful only with `Duration`. | ||
/// | ||
/// Instants are always guaranteed to be greater than any previously measured | ||
/// Instants are always guaranteed to no less than any previously measured |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"be no less" ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, thanks
@bors: r+ rollup |
📌 Commit 97d046a has been approved by |
…lexcrichton Instant is monotonically nondecreasing We don't want to guarantee that `Instant::now() != Instant::now()` is always true since that depends on the speed of the processor and the resolution of the clock.
We don't want to guarantee that
Instant::now() != Instant::now()
isalways true since that depends on the speed of the processor and the
resolution of the clock.