Skip to main content

nanos_to_proto

Function nanos_to_proto 

pub fn nanos_to_proto(n: UnixNanos) -> Timestamp
Expand description

Converts nanoseconds since the Unix epoch to a protobuf Timestamp. Negative times keep a non-negative nanos part, as protobuf requires.

§Examples

use brokapi_core::UnixNanos;
use brokapi_tbank::ids::nanos_to_proto;

let ts = nanos_to_proto(UnixNanos::from_nanos(2_000_000_007));
assert_eq!((ts.seconds, ts.nanos), (2, 7));