(t: &StructTimeData, vm: &VirtualMachine)
| 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))?; |
no test coverage detected