@@ -80,8 +80,8 @@ pub fn nanos_since_unix_epoch() -> u64 {
80
80
81
81
/// Represents an atomic timekeeping structure.
82
82
///
83
- /// `AtomicTime` can act as a real-time clock or static clock based on its mode.
84
- /// It uses `AtomicU64` to atomically update the value using only immutable
83
+ /// [ `AtomicTime`] can act as a real-time clock or static clock based on its mode.
84
+ /// It uses an [ `AtomicU64`] to atomically update the value using only immutable
85
85
/// references.
86
86
///
87
87
/// This struct provides thread-safe access to a stored nanosecond time value,
@@ -128,8 +128,8 @@ impl AtomicTime {
128
128
/// Get time in nanoseconds.
129
129
///
130
130
/// - **Real-time mode**: Returns the current wall clock time since the UNIX epoch,
131
- /// ensuring monotonicity across threads using `Ordering::SeqCst`.
132
- /// - **Static mode**: Returns the currently stored time, which uses `Ordering::Relaxed`
131
+ /// ensuring monotonicity across threads using [ `Ordering::SeqCst`] .
132
+ /// - **Static mode**: Returns the currently stored time, which uses [ `Ordering::Relaxed`]
133
133
/// and is suitable for single-threaded scenarios where strict synchronization is unnecessary.
134
134
#[ must_use]
135
135
pub fn get_time_ns ( & self ) -> UnixNanos {
@@ -159,23 +159,23 @@ impl AtomicTime {
159
159
160
160
/// Sets new time for the clock.
161
161
///
162
- /// Intended for single-threaded use, as it relies on `Ordering::Relaxed` and
162
+ /// Intended for single-threaded use, as it relies on [ `Ordering::Relaxed`] and
163
163
/// does not enforce strict synchronization.
164
164
pub fn set_time ( & self , time : UnixNanos ) {
165
165
self . store ( time. into ( ) , Ordering :: Relaxed ) ;
166
166
}
167
167
168
168
/// Increments the current time by the specified delta and returns the updated value.
169
169
///
170
- /// Intended for single-threaded use, as it relies on `Ordering::Relaxed` and
170
+ /// Intended for single-threaded use, as it relies on [ `Ordering::Relaxed`] and
171
171
/// does not enforce strict synchronization.
172
172
pub fn increment_time ( & self , delta : u64 ) -> UnixNanos {
173
173
UnixNanos :: from ( self . fetch_add ( delta, Ordering :: Relaxed ) + delta)
174
174
}
175
175
176
176
/// Stores and returns current time.
177
177
///
178
- /// This method uses `Ordering::SeqCst` (Sequential Consistency) ordering to ensure that:
178
+ /// This method uses [ `Ordering::SeqCst`] (Sequential Consistency) ordering to ensure that:
179
179
/// 1. Timestamps are monotonically increasing and thread-safe.
180
180
/// 2. The returned timestamp is never less than the current system time.
181
181
/// 3. Each timestamp is at least 1 nanosecond greater than the last stored value.
@@ -195,14 +195,14 @@ impl AtomicTime {
195
195
196
196
/// Switches the clock to real-time mode.
197
197
///
198
- /// Intended for single-threaded use, as it uses `Ordering::Relaxed` for updating the mode.
198
+ /// Intended for single-threaded use, as it uses [ `Ordering::Relaxed`] for updating the mode.
199
199
pub fn make_realtime ( & self ) {
200
200
self . realtime . store ( true , Ordering :: Relaxed ) ;
201
201
}
202
202
203
203
/// Switches the clock to static mode.
204
204
///
205
- /// Intended for single-threaded use, as it uses `Ordering::Relaxed` for updating the mode.
205
+ /// Intended for single-threaded use, as it uses [ `Ordering::Relaxed`] for updating the mode.
206
206
pub fn make_static ( & self ) {
207
207
self . realtime . store ( false , Ordering :: Relaxed ) ;
208
208
}
0 commit comments