Skip to main content

sas_datetime_to_unix_subsec

Function sas_datetime_to_unix_subsec 

Source
fn sas_datetime_to_unix_subsec(val: f64, scale: f64) -> Option<i64>
Expand description

Converts a SAS datetime (seconds since 1960-01-01, possibly fractional) to a Unix-epoch timestamp at the given sub-second scale (1e3 for ms, 1e6 for µs, 1e9 for ns). Rounds rather than truncates: f64 representation error at SAS-datetime magnitudes (~1.9e9 s) is larger than one sub-second unit, so truncation would land one unit low about half the time.