Skip to main content

parse_optional_millis_to_nanos

Function parse_optional_millis_to_nanos 

Source
pub fn parse_optional_millis_to_nanos(millis: i64) -> Result<Option<UnixNanos>>
Expand description

Converts a signed Unix millisecond timestamp into [UnixNanos].

Negative inputs are mapped to Ok(None) so callers can model fields where the wire uses -1 (or any negative sentinel) as “absent”. Fields that overload 0 with a separate meaning (e.g. 0 for IOC on OrderInfo::order_expiry) must apply that interpretation at the call site; this helper treats 0 as a literal Unix epoch timestamp.

§Errors

Returns an error if a non-negative millis overflows when scaled to nanoseconds.