diff options
Diffstat (limited to 'crates/tor-checkable/src/timed.rs')
| -rw-r--r-- | crates/tor-checkable/src/timed.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/crates/tor-checkable/src/timed.rs b/crates/tor-checkable/src/timed.rs index 72fd7dfb9..a187212e2 100644 --- a/crates/tor-checkable/src/timed.rs +++ b/crates/tor-checkable/src/timed.rs @@ -1,7 +1,7 @@ //! Convenience implementation of a TimeBound object. use std::ops::{Bound, Deref, RangeBounds}; -use std::time; +use web_time_compat as time; /// A TimeBound object that is valid for a specified range of time. /// @@ -9,10 +9,10 @@ use std::time; /// /// /// ``` -/// use std::time::{SystemTime, Duration}; +/// use web_time_compat::{SystemTime, SystemTimeExt, Duration}; /// use tor_checkable::{Timebound, TimeValidityError, timed::TimerangeBound}; /// -/// let now = SystemTime::now(); +/// let now = SystemTime::get(); /// let one_hour = Duration::new(3600, 0); /// /// // This seven is only valid for another hour! @@ -222,7 +222,7 @@ mod test { use super::*; use crate::{TimeValidityError, Timebound}; use humantime::parse_rfc3339; - use std::time::{Duration, SystemTime}; + use web_time_compat::{Duration, SystemTime, SystemTimeExt}; #[test] fn test_bounds() { @@ -309,7 +309,7 @@ mod test { assert_eq!(tr.check_valid_at_opt(None), Ok("hello world")); let tr = TimerangeBound::new("hello world", de..); assert_eq!( - tr.check_valid_at_opt(Some(SystemTime::now())), + tr.check_valid_at_opt(Some(SystemTime::get())), Ok("hello world") ); let tr = TimerangeBound::new("hello world", ..za); @@ -318,7 +318,7 @@ mod test { #[test] fn test_dangerous() { - let t1 = SystemTime::now(); + let t1 = SystemTime::get(); let t2 = t1 + Duration::from_secs(60 * 525600); let tr = TimerangeBound::new("cups of coffee", t1..=t2); @@ -332,7 +332,7 @@ mod test { #[test] fn test_map() { - let t1 = SystemTime::now(); + let t1 = SystemTime::get(); let min = Duration::from_secs(60); let tb = TimerangeBound::new(17_u32, t1..t1 + 5 * min); @@ -346,7 +346,7 @@ mod test { #[test] fn test_as_ref() { - let t1 = SystemTime::now(); + let t1 = SystemTime::get(); let min = Duration::from_secs(60); let tb1: TimerangeBound<String> = TimerangeBound::new("hi".into(), t1..t1 + 5 * min); |
