MCPcopy Create free account
hub / github.com/endbasic/endbasic / current_time_millis

Function current_time_millis

web/src/datetime.rs:59–68  ·  view source on GitHub ↗

Returns the current monotonic time in milliseconds.

()

Source from the content-addressed store, hash-verified

57
58/// Returns the current monotonic time in milliseconds.
59pub(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.
71pub(crate) struct WebDateTime {

Callers 4

newMethod · 0.85
on_host_yieldMethod · 0.85
yield_nowMethod · 0.85
monotonicMethod · 0.85

Calls 1

nowMethod · 0.80

Tested by

no test coverage detected