scufflecloud_core/
chrono_ext.rs

1use tinc::well_known::prost::Timestamp;
2
3pub(crate) trait ChronoDateTimeExt {
4    fn to_prost_timestamp_utc(&self) -> Timestamp;
5}
6
7impl<Z: chrono::TimeZone> ChronoDateTimeExt for chrono::DateTime<Z> {
8    fn to_prost_timestamp_utc(&self) -> Timestamp {
9        let utc = self.to_utc();
10        Timestamp {
11            seconds: utc.timestamp(),
12            nanos: utc.timestamp_subsec_nanos() as i32,
13        }
14    }
15}