(
when: time_t,
vm: &VirtualMachine,
)
| 1159 | |
| 1160 | #[cfg_attr(target_env = "musl", allow(deprecated))] |
| 1161 | pub(super) fn localtime_from_timestamp( |
| 1162 | when: time_t, |
| 1163 | vm: &VirtualMachine, |
| 1164 | ) -> PyResult<StructTimeData> { |
| 1165 | let mut out = core::mem::MaybeUninit::<libc::tm>::uninit(); |
| 1166 | let ret = unsafe { libc::localtime_r(&when, out.as_mut_ptr()) }; |
| 1167 | if ret.is_null() { |
| 1168 | return Err(vm.new_overflow_error("timestamp out of range for platform time_t")); |
| 1169 | } |
| 1170 | Ok(struct_time_from_tm(vm, unsafe { out.assume_init() })) |
| 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)?; |
no test coverage detected