Construct a localtime from the optional seconds, or get the current local time.
(self, vm: &VirtualMachine)
| 330 | impl OptionalArg<Option<Either<f64, i64>>> { |
| 331 | /// Construct a localtime from the optional seconds, or get the current local time. |
| 332 | fn naive_or_local(self, vm: &VirtualMachine) -> PyResult<NaiveDateTime> { |
| 333 | Ok(match self { |
| 334 | Self::Present(Some(secs)) => pyobj_to_date_time(secs, vm)? |
| 335 | .with_timezone(&chrono::Local) |
| 336 | .naive_local(), |
| 337 | Self::Present(None) | Self::Missing => chrono::offset::Local::now().naive_local(), |
| 338 | }) |
| 339 | } |
| 340 | } |
| 341 | |
| 342 | #[cfg(any(unix, windows))] |
no test coverage detected