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

Function timestamp_us_to_datetime

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

Source from the content-addressed store, hash-verified

186/// converts a `i64` representing a `timestamp(us)` to [`NaiveDateTime`]
187#[inline]
188pub fn timestamp_us_to_datetime(v: i64) -> Option<NaiveDateTime> {
189 let (sec, micro_sec) = split_second(v, MICROSECONDS);
190
191 let datetime = DateTime::from_timestamp(
192 // extract seconds from microseconds
193 sec,
194 // discard extracted seconds and convert microseconds to nanoseconds
195 micro_sec * MILLISECONDS as u32,
196 )?;
197 Some(datetime.naive_utc())
198}
199
200/// converts a `i64` representing a `timestamp(ns)` to [`NaiveDateTime`]
201#[inline]

Callers 2

date_partMethod · 0.85
as_datetimeFunction · 0.85

Calls 1

split_secondFunction · 0.85

Tested by

no test coverage detected