File tree Expand file tree Collapse file tree 2 files changed +2
-2
lines changed Expand file tree Collapse file tree 2 files changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ impl Timespec {
28
28
#[ rustc_const_unstable( feature = "const_system_time" , issue = "144517" ) ]
29
29
const fn sub_timespec ( & self , other : & Timespec ) -> Result < Duration , Duration > {
30
30
// FIXME: const PartialOrd
31
- let mut cmp = self . t . tv_sec - other. t . tv_sec ;
31
+ let mut cmp = self . t . tv_sec . saturating_sub ( other. t . tv_sec ) ;
32
32
if cmp == 0 {
33
33
cmp = self . t . tv_nsec as i64 - other. t . tv_nsec as i64 ;
34
34
}
Original file line number Diff line number Diff line change @@ -139,7 +139,7 @@ impl Timespec {
139
139
#[ rustc_const_unstable( feature = "const_system_time" , issue = "144517" ) ]
140
140
pub const fn sub_timespec ( & self , other : & Timespec ) -> Result < Duration , Duration > {
141
141
// FIXME: const PartialOrd
142
- let mut cmp = self . tv_sec - other. tv_sec ;
142
+ let mut cmp = self . tv_sec . saturating_sub ( other. tv_sec ) ;
143
143
if cmp == 0 {
144
144
cmp = self . tv_nsec . as_inner ( ) as i64 - other. tv_nsec . as_inner ( ) as i64 ;
145
145
}
You can’t perform that action at this time.
0 commit comments