File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -19,8 +19,6 @@ use crate::internal_macros::{
1919#[ cfg( feature = "std" ) ]
2020#[ allow( deprecated) ]
2121use crate :: Instant ;
22- #[ cfg( feature = "std" ) ]
23- use crate :: OffsetDateTime ;
2422
2523/// By explicitly inserting this enum where padding is expected, the compiler is able to better
2624/// perform niche value optimization.
@@ -1586,7 +1584,14 @@ impl Sub<Duration> for SystemTime {
15861584 type Output = Self ;
15871585
15881586 fn sub ( self , duration : Duration ) -> Self :: Output {
1589- ( OffsetDateTime :: from ( self ) - duration) . into ( )
1587+ if duration. is_zero ( ) {
1588+ self
1589+ } else if duration. is_positive ( ) {
1590+ self - duration. unsigned_abs ( )
1591+ } else {
1592+ debug_assert ! ( duration. is_negative( ) ) ;
1593+ self + duration. unsigned_abs ( )
1594+ }
15901595 }
15911596}
15921597
You can’t perform that action at this time.
0 commit comments