Skip to content

Commit 5d03e02

Browse files
committed
Minor tweaks in the clock module
1 parent d22f4f3 commit 5d03e02

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/common/time/clock.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,9 @@ impl Default for ClockType {
3838
fn default() -> Self {
3939
#[cfg(feature = "quanta")]
4040
{
41-
// Try to get the both origins at close to the same time. Assuming that
42-
// `quanta::Instant::now` has lower latency than `StdInstant::now`.
43-
let quanta_origin = quanta::Instant::now();
44-
let std_origin = StdInstant::now();
4541
return ClockType::Hybrid {
46-
std_origin,
47-
quanta_origin,
42+
std_origin: StdInstant::now(),
43+
quanta_origin: quanta::Instant::now(),
4844
};
4945
}
5046

@@ -113,6 +109,9 @@ impl Clock {
113109
}
114110

115111
/// Converts an `Instant` to a `std::time::Instant`.
112+
///
113+
/// **IMPORTANT**: The caller must ensure that the `Instant` was created by this
114+
/// `Clock`, otherwise the resulting `std::time::Instant` will be incorrect.
116115
pub(crate) fn to_std_instant(&self, instant: Instant) -> StdInstant {
117116
match &self.ty {
118117
ClockType::Standard { origin } => {

0 commit comments

Comments
 (0)