MCPcopy Create free account
hub / github.com/apache/arrow-rs / timestamp_ns_to_datetime

Function timestamp_ns_to_datetime

arrow-array/src/temporal_conversions.rs:202–211  ·  view source on GitHub ↗
(v: i64)

Source from the content-addressed store, hash-verified

200/// converts a `i64` representing a `timestamp(ns)` to [`NaiveDateTime`]
201#[inline]
202pub 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]
214pub(crate) fn split_second(v: i64, base: i64) -> (i64, u32) {

Callers 2

date_partMethod · 0.85
as_datetimeFunction · 0.85

Calls 1

split_secondFunction · 0.85

Tested by

no test coverage detected