summaryrefslogtreecommitdiff
path: root/crates/web-time-compat/src/stdlib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/web-time-compat/src/stdlib.rs')
-rw-r--r--crates/web-time-compat/src/stdlib.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/crates/web-time-compat/src/stdlib.rs b/crates/web-time-compat/src/stdlib.rs
new file mode 100644
index 000000000..891a0e0f7
--- /dev/null
+++ b/crates/web-time-compat/src/stdlib.rs
@@ -0,0 +1,21 @@
+//! Standard-library time functionality..
+
+// If we've forbidden `now` elsewhere in our project, we enable it here.
+// (And only here!)
+#![allow(clippy::disallowed_methods)]
+
+pub use std::time::Instant;
+
+use std::time::SystemTime;
+
+impl crate::SystemTimeExt for SystemTime {
+ fn get() -> SystemTime {
+ SystemTime::now()
+ }
+}
+
+impl crate::InstantExt for Instant {
+ fn get() -> crate::Instant {
+ Instant::now()
+ }
+}