Returns the current monotonic time in milliseconds.
()
| 57 | |
| 58 | /// Returns the current monotonic time in milliseconds. |
| 59 | pub(crate) fn current_time_millis() -> f64 { |
| 60 | let window = match web_sys::window() { |
| 61 | Some(window) => window, |
| 62 | None => log_and_panic!("Failed to get window"), |
| 63 | }; |
| 64 | match window.performance() { |
| 65 | Some(performance) => performance.now(), |
| 66 | None => js_sys::Date::now(), |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | /// Browser-backed implementation of date and time facilities. |
| 71 | pub(crate) struct WebDateTime { |
no test coverage detected