Change:
This is a tracking issue for PR . This feature adds a function to and as a prerequisite also for all platform specific time structs. This also led to the refactoring of many functions to avoid redundancy (they now unwrap the result of ).
This should be to as well. We're seeing some need for this in to handle wait timeouts.
I pushed a PR () for adding the same functionality to under the same feature gate name. I hope this is fine. They seem extremely related (and share a lot of the implementation) and the feature name fits both.
This has now been extended so the feature covers both and on both and . Together with the fact that already have these, it's now possible to handle all time types without risking panics on nightly (whenever the next nightly comes out).
Covered by this feature: Looks good to me. fcp merge
Team member has proposed to merge this. The next step is review by the rest of the tagged team members: [ ] [x] [x] [x] [x] [ ] 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 for info about what commands tagged team members can give me.
:bell: This is now entering its final comment period, as per the . :bell:
Why no ?
The final comment period, with a disposition to merge, as per the , is now complete.
Implemented :
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 when we developed and .
OK, renaming the feature in the pull request.

Discussion:
/// Returns `Some(t)` where `t` is the time `self + duration` if `t` can be represented as /// `Instant` (which means it's inside the bounds of the underlying data structure), `None` /// otherwise. <del> #[unstable(feature = "time_checked_add", issue = "55940")] </del> <ins> #[stable(feature = "time_checked_add", since = "1.34.0")] </ins> pub fn checked_add(&self, duration: Duration) -> Option<Instant> { <del> self.0.checked_add_duration(&duration).map(|t| Instant(t)) </del> <ins> self.0.checked_add_duration(&duration).map(Instant) </ins> } /// Returns `Some(t)` where `t` is the time `self - duration` if `t` can be represented as /// `Instant` (which means it's inside the bounds of the underlying data structure), `None` /// otherwise. <del> #[unstable(feature = "time_checked_add", issue = "55940")] </del> <ins> #[stable(feature = "time_checked_add", since = "1.34.0")] </ins> pub fn checked_sub(&self, duration: Duration) -> Option<Instant> { <del> self.0.checked_sub_duration(&duration).map(|t| Instant(t)) </del> <ins> self.0.checked_sub_duration(&duration).map(Instant) </ins> } }

/// Returns `Some(t)` where `t` is the time `self + duration` if `t` can be represented as /// `SystemTime` (which means it's inside the bounds of the underlying data structure), `None` /// otherwise. <del> #[unstable(feature = "time_checked_add", issue = "55940")] </del> <ins> #[stable(feature = "time_checked_add", since = "1.34.0")] </ins> pub fn checked_add(&self, duration: Duration) -> Option<SystemTime> { <del> self.0.checked_add_duration(&duration).map(|t| SystemTime(t)) </del> <ins> self.0.checked_add_duration(&duration).map(SystemTime) </ins> } /// Returns `Some(t)` where `t` is the time `self - duration` if `t` can be represented as /// `SystemTime` (which means it's inside the bounds of the underlying data structure), `None` /// otherwise. <del> #[unstable(feature = "time_checked_add", issue = "55940")] </del> <ins> #[stable(feature = "time_checked_add", since = "1.34.0")] </ins> pub fn checked_sub(&self, duration: Duration) -> Option<SystemTime> { <del> self.0.checked_sub_duration(&duration).map(|t| SystemTime(t)) </del> <ins> self.0.checked_sub_duration(&duration).map(SystemTime) </ins> } }