-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Tracking issue for time_checked_add
feature
#55940
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
This should be added to |
I pushed a PR (#56490) for adding the same functionality to |
…=alexcrichton Add checked_add method to Instant time type Appending functionality to the already opened topic of `checked_add` on time types over at rust-lang#55940. Doing checked addition between an `Instant` and a `Duration` is important to reliably determine a future instant. We could use this in the `parking_lot` crate to compute an instant when in the future to wake a thread up without risking a panic.
Add checked_add method to Instant time type Appending functionality to the already opened topic of `checked_add` on time types over at #55940. Doing checked addition between an `Instant` and a `Duration` is important to reliably determine a future instant. We could use this in the `parking_lot` crate to compute an instant when in the future to wake a thread up without risking a panic.
…=alexcrichton Add checked_add method to Instant time type Appending functionality to the already opened topic of `checked_add` on time types over at rust-lang#55940. Doing checked addition between an `Instant` and a `Duration` is important to reliably determine a future instant. We could use this in the `parking_lot` crate to compute an instant when in the future to wake a thread up without risking a panic.
Add checked_add method to Instant time type Appending functionality to the already opened topic of `checked_add` on time types over at #55940. Doing checked addition between an `Instant` and a `Duration` is important to reliably determine a future instant. We could use this in the `parking_lot` crate to compute an instant when in the future to wake a thread up without risking a panic.
This has now been extended so the feature covers both |
Covered by this feature: impl Instant {
pub fn checked_add(&self, duration: Duration) -> Option<Instant> {
pub fn checked_sub(&self, duration: Duration) -> Option<Instant> {
}
impl SystemTime {
pub fn checked_add(&self, duration: Duration) -> Option<SystemTime> {
pub fn checked_sub(&self, duration: Duration) -> Option<SystemTime> {
} Looks good to me. @rfcbot fcp merge |
Team member @SimonSapin has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and none object), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
Why no |
The final comment period, with a disposition to merge, as per the review above, is now complete. |
Implemented |
@vi Could we not keep that as a separate feature? As to not slow this one down. No one reported they might have any need for |
OK, renaming the feature in the pull request. |
…=alexcrichton Stabilize the time_checked_add feature Closes rust-lang#55940 Stabilizes `checked_add` and `checked_sub` on `Instant` and `SystemTime`.
…=alexcrichton Stabilize the time_checked_add feature Closes rust-lang#55940 Stabilizes `checked_add` and `checked_sub` on `Instant` and `SystemTime`.
…=alexcrichton Stabilize the time_checked_add feature Closes rust-lang#55940 Stabilizes `checked_add` and `checked_sub` on `Instant` and `SystemTime`.
This is a tracking issue for PR #55527 .
This feature adds a
checked_add(&self, &Duration) -> Option<SystemTime>
function tostd::time::SystemTime
and as a prerequisite also for all platform specific time structs. This also led to the refactoring of manyadd_duration(&self, &Duration) -> SystemTime
functions to avoid redundancy (they now unwrap the result ofchecked_add_duration
).The text was updated successfully, but these errors were encountered: