MCPcopy Index your code
hub / github.com/RustPython/RustPython / duration_since_system_now

Function duration_since_system_now

crates/vm/src/stdlib/time.rs:75–81  ·  view source on GitHub ↗
(vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

73 pub(super) const NS_TO_US: i64 = 1000;
74
75 fn duration_since_system_now(vm: &VirtualMachine) -> PyResult<Duration> {
76 use std::time::{SystemTime, UNIX_EPOCH};
77
78 SystemTime::now()
79 .duration_since(UNIX_EPOCH)
80 .map_err(|e| vm.new_value_error(format!("Time error: {e:?}")))
81 }
82
83 #[pyattr]
84 pub const _STRUCT_TM_ITEMS: usize = 11;

Callers 4

get_monotonic_timeFunction · 0.85
get_perf_timeFunction · 0.85
time_nsFunction · 0.85
_timeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected