5
5
use cfg_if:: cfg_if;
6
6
7
7
cfg_if ! {
8
- if #[ cfg( feature = "testing" ) ] {
8
+ if #[ cfg( any ( feature = "testing" , test ) ) ] {
9
9
pub use if_testing:: * ;
10
10
} else if #[ cfg( feature = "std" ) ] {
11
11
pub use if_std:: * ;
@@ -60,7 +60,7 @@ mod if_no_std {
60
60
static CLOCK_STATE : AtomicUsize = AtomicUsize :: new ( CLOCK_UNINITIALIZED ) ;
61
61
62
62
/// Initialize the global Clock for use in `no-std` mode.
63
- /// The configured clock will be queried on all `Timestamp ::now()` calls.
63
+ /// The configured clock will be queried on all `crate::time ::now()` calls.
64
64
/// The global clock can only be set once.
65
65
pub fn init_global_clock ( clock : & ' static dyn Clock ) -> Result < ( ) , ( ) > {
66
66
unsafe {
@@ -114,9 +114,9 @@ mod if_testing {
114
114
115
115
cfg_if ! {
116
116
if #[ cfg( feature = "std" ) ] {
117
- pub use super :: if_std:: now as inner_now;
117
+ use super :: if_std:: now as inner_now;
118
118
} else {
119
- pub use super :: if_no_std:: now as inner_now;
119
+ use super :: if_no_std:: now as inner_now;
120
120
}
121
121
}
122
122
@@ -154,19 +154,20 @@ mod if_testing {
154
154
use std:: sync:: Mutex ;
155
155
156
156
/// Configures a [`Clock`] which will be utilized for the following
157
- /// calls to `Timestamp ::now()` on the current thread.
157
+ /// calls to `crate::time ::now()` on the current thread.
158
158
///
159
159
/// Example:
160
160
///
161
- /// ```
161
+ /// ```ignore
162
162
/// # use core::time::Duration;
163
- /// use s2n_quic_platform::time::{testing, Timestamp};
164
- /// let clock = std::sync::Arc::new(testing::MockClock::new());
163
+ /// use std::sync::Arc;
164
+ /// use s2n_quic_platform::time::{self, testing};
165
+ /// let clock = Arc::new(testing::MockClock::new());
165
166
/// testing::set_local_clock(clock.clone());
166
167
///
167
- /// let before = Timestamp ::now();
168
+ /// let before = time ::now();
168
169
/// clock.adjust_by(Duration::from_millis(333));
169
- /// let after = Timestamp ::now();
170
+ /// let after = time ::now();
170
171
/// assert_eq!(after - before, Duration::from_millis(333));
171
172
/// ```
172
173
pub fn set_local_clock ( clock : Arc < dyn Clock > ) {
@@ -177,7 +178,7 @@ mod if_testing {
177
178
178
179
/// Resets the local clock.
179
180
///
180
- /// Following invocations to [`Timestamp ::now()`]
181
+ /// Following invocations to [`crate::time ::now()`]
181
182
/// will return the system time again.
182
183
pub fn reset_local_clock ( ) {
183
184
LOCAL_CLOCK . with ( |current_local_clock| {
0 commit comments