(secs: OptionalArg<Option<Either<f64, i64>>>, vm: &VirtualMachine)
| 618 | |
| 619 | #[pyfunction] |
| 620 | fn ctime(secs: OptionalArg<Option<Either<f64, i64>>>, vm: &VirtualMachine) -> PyResult<String> { |
| 621 | #[cfg(any(unix, windows))] |
| 622 | { |
| 623 | let ts = match secs { |
| 624 | OptionalArg::Present(Some(value)) => pyobj_to_time_t(value, vm)?, |
| 625 | OptionalArg::Present(None) | OptionalArg::Missing => current_time_t(), |
| 626 | }; |
| 627 | let local = localtime_from_timestamp(ts, vm)?; |
| 628 | let tm = checked_tm_from_struct_time(&local, vm, "asctime")?.tm; |
| 629 | Ok(asctime_from_tm(&tm)) |
| 630 | } |
| 631 | |
| 632 | #[cfg(not(any(unix, windows)))] |
| 633 | { |
| 634 | let instant = secs.naive_or_local(vm)?; |
| 635 | Ok(instant.format(CFMT).to_string()) |
| 636 | } |
| 637 | } |
| 638 | |
| 639 | #[cfg(any(unix, windows))] |
| 640 | fn strftime_crt(format: &PyStrRef, checked_tm: CheckedTm, vm: &VirtualMachine) -> PyResult { |
nothing calls this directly
no test coverage detected