aboutsummaryrefslogtreecommitdiff
path: root/src/native.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/native.rs')
-rw-r--r--src/native.rs16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/native.rs b/src/native.rs
index 37d5da4..37b34f3 100644
--- a/src/native.rs
+++ b/src/native.rs
@@ -1,7 +1,9 @@
-pub type Instant = std::time::Instant;
-
-/// The current time, in milliseconds.
-#[cfg(feature = "now")]
-pub fn now() -> f64 {
- time::precise_time_s() * 1000.0
-}
+pub type Instant = std::time::Instant;
+pub type SystemTime = std::time::SystemTime;
+
+/// The current time, expressed in milliseconds since the Unix Epoch.
+pub fn now() -> f64 {
+ std::time::SystemTime::now().duration_since(std::time::SystemTime::UNIX_EPOCH)
+ .expect("System clock was before 1970.")
+ .as_secs_f64() * 1000.0
+}