pub fn nanos_to_datetime(nanos: UnixNanos) -> DateTime<Utc>Expand description
Converts a time in nanoseconds since the Unix epoch to a UTC date and time.
Sub-second precision is kept. A value that is out of the range of dates falls back to the current time, so this function never fails (and never panics).
§Examples
use brokapi_bcs::util::nanos_to_datetime;
use brokapi_core::UnixNanos;
let dt = nanos_to_datetime(UnixNanos::from_nanos(1_000_000_000));
assert_eq!(dt.timestamp(), 1);