@@ -361,9 +361,9 @@ impl SystemTime {
361
361
/// Returns `Some(t)` where `t` is the time `self + duration` if `t` can be represented as
362
362
/// `SystemTime` (which means it's inside the bounds of the underlying data structure), `None`
363
363
/// otherwise.
364
- #[ stable ( feature = "time_checked_add" , since = "1.32.0 " ) ]
365
- pub fn checked_add_duration ( & self , duration : & Duration ) -> Option < SystemTime > {
366
- self . 0 . checked_add_duration ( duration) . map ( |t| SystemTime ( t) )
364
+ #[ unstable ( feature = "time_checked_add" , issue = "55940 " ) ]
365
+ pub fn checked_add ( & self , duration : Duration ) -> Option < SystemTime > {
366
+ self . 0 . checked_add_duration ( & duration) . map ( |t| SystemTime ( t) )
367
367
}
368
368
}
369
369
@@ -571,13 +571,13 @@ mod tests {
571
571
let max_duration = Duration :: from_secs ( u64:: max_value ( ) ) ;
572
572
// in case `SystemTime` can store `>= UNIX_EPOCH + max_duration`.
573
573
for _ in 0 ..2 {
574
- maybe_t = maybe_t. and_then ( |t| t. checked_add_duration ( & max_duration) ) ;
574
+ maybe_t = maybe_t. and_then ( |t| t. checked_add ( max_duration) ) ;
575
575
}
576
576
assert_eq ! ( maybe_t, None ) ;
577
577
578
578
// checked_add_duration calculates the right time and will work for another year
579
579
let year = Duration :: from_secs ( 60 * 60 * 24 * 365 ) ;
580
- assert_eq ! ( a + year, a. checked_add_duration ( & year) . unwrap( ) ) ;
580
+ assert_eq ! ( a + year, a. checked_add ( year) . unwrap( ) ) ;
581
581
}
582
582
583
583
#[ test]
0 commit comments