caretta-sync/core/src/utils/mod.rs

13 lines
319 B
Rust
Raw Normal View History

2025-08-12 07:29:23 +09:00
use prost_types::Timestamp;
use chrono::{DateTime, Timelike, Utc};
pub mod async_convert;
pub mod emptiable;
2025-07-04 08:05:43 +09:00
pub mod mergeable;
pub mod runnable;
2025-08-12 07:29:23 +09:00
pub fn utc_to_timestamp(utc: DateTime<Utc>) -> Timestamp {
Timestamp{
seconds: utc.timestamp(),
nanos: i32::try_from(utc.nanosecond()).unwrap(),
}
}