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

Function unix_mktime

crates/vm/src/stdlib/time.rs:1173–1180  ·  view source on GitHub ↗
(t: &StructTimeData, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

1171 }
1172
1173 pub(super) fn unix_mktime(t: &StructTimeData, vm: &VirtualMachine) -> PyResult<f64> {
1174 let mut tm = super::decl::tm_from_struct_time(t, vm)?;
1175 let timestamp = unsafe { libc::mktime(&mut tm) };
1176 if timestamp == -1 && tm.tm_wday == -1 {
1177 return Err(vm.new_overflow_error("mktime argument out of range"));
1178 }
1179 Ok(timestamp as f64)
1180 }
1181
1182 fn get_clock_time(clk_id: ClockId, vm: &VirtualMachine) -> PyResult<Duration> {
1183 let ts = nix::time::clock_gettime(clk_id).map_err(|e| e.into_pyexception(vm))?;

Callers 1

mktimeFunction · 0.85

Calls 3

tm_from_struct_timeFunction · 0.85
mktimeFunction · 0.85
ErrClass · 0.50

Tested by

no test coverage detected