use chrono::{DateTime, TimeZone, Timelike, Utc};
use prost_types::Timestamp;
pub mod async_convert;
pub mod emptiable;
pub mod mergeable;
pub mod runnable;
pub fn utc_to_timestamp(utc: &DateTime<Utc>) -> Timestamp {
Timestamp {
seconds: utc.timestamp(),
nanos: i32::try_from(utc.nanosecond()).unwrap(),
}
}
pub fn timestamp_to_utc(t: &Timestamp) -> DateTime<Utc> {
Utc.timestamp_opt(t.seconds, u32::try_from(t.nanos).unwrap())
.unwrap()
}
pub fn get_binary_name() -> Option<String> {
std::env::current_exe()
.ok()?
.file_name()?
.to_str()?
.to_owned()
.into()
}