diff options
Diffstat (limited to 'third_party/rust/instant/src/native.rs')
-rw-r--r-- | third_party/rust/instant/src/native.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/third_party/rust/instant/src/native.rs b/third_party/rust/instant/src/native.rs new file mode 100644 index 0000000000..37b34f3e8b --- /dev/null +++ b/third_party/rust/instant/src/native.rs @@ -0,0 +1,9 @@ +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
+}
|