about summary refs log tree commit diff
path: root/src/libstd/sys/redox
diff options
context:
space:
mode:
authorLinus Färnstrand <faern@faern.net>2018-12-04 02:29:57 +0100
committerLinus Färnstrand <faern@faern.net>2018-12-13 15:25:14 +0100
commit13f0463a195832f10f0f22105ad14e6d6b2eff59 (patch)
treeaa93f5e194b0d3a8d74072cee40bdc0b8cbaa5a6 /src/libstd/sys/redox
parent9fe5cb5342244a716055fa0162e795deabd4985c (diff)
downloadrust-13f0463a195832f10f0f22105ad14e6d6b2eff59.tar.gz
rust-13f0463a195832f10f0f22105ad14e6d6b2eff59.zip
Add checked_add method to Instant time type
Diffstat (limited to 'src/libstd/sys/redox')
-rw-r--r--src/libstd/sys/redox/time.rs12
1 files changed, 2 insertions, 10 deletions
diff --git a/src/libstd/sys/redox/time.rs b/src/libstd/sys/redox/time.rs
index beff8d287e7..5ba8b780727 100644
--- a/src/libstd/sys/redox/time.rs
+++ b/src/libstd/sys/redox/time.rs
@@ -41,10 +41,6 @@ impl Timespec {
         }
     }
 
-    fn add_duration(&self, other: &Duration) -> Timespec {
-        self.checked_add_duration(other).expect("overflow when adding duration to time")
-    }
-
     fn checked_add_duration(&self, other: &Duration) -> Option<Timespec> {
         let mut secs = other
             .as_secs()
@@ -150,8 +146,8 @@ impl Instant {
         })
     }
 
-    pub fn add_duration(&self, other: &Duration) -> Instant {
-        Instant { t: self.t.add_duration(other) }
+    pub fn checked_add_duration(&self, other: &Duration) -> Option<Instant> {
+        self.t.checked_add_duration(other).map(|t| Instant { t })
     }
 
     pub fn sub_duration(&self, other: &Duration) -> Instant {
@@ -178,10 +174,6 @@ impl SystemTime {
         self.t.sub_timespec(&other.t)
     }
 
-    pub fn add_duration(&self, other: &Duration) -> SystemTime {
-        SystemTime { t: self.t.add_duration(other) }
-    }
-
     pub fn checked_add_duration(&self, other: &Duration) -> Option<SystemTime> {
         self.t.checked_add_duration(other).map(|t| SystemTime { t })
     }