(v: i64)
| 200 | /// converts a `i64` representing a `timestamp(ns)` to [`NaiveDateTime`] |
| 201 | #[inline] |
| 202 | pub fn timestamp_ns_to_datetime(v: i64) -> Option<NaiveDateTime> { |
| 203 | let (sec, nano_sec) = split_second(v, NANOSECONDS); |
| 204 | |
| 205 | let datetime = DateTime::from_timestamp( |
| 206 | // extract seconds from nanoseconds |
| 207 | sec, // discard extracted seconds |
| 208 | nano_sec, |
| 209 | )?; |
| 210 | Some(datetime.naive_utc()) |
| 211 | } |
| 212 | |
| 213 | #[inline] |
| 214 | pub(crate) fn split_second(v: i64, base: i64) -> (i64, u32) { |
no test coverage detected