use crate::google::protobuf::Timestamp;
pub use prost::Message;
use std::time;

// Include the `items` module, which is generated from items.proto.
include!("generated/_include.rs");

impl Timestamp {
    /// Returns a new `Timestamp` representing the current time.
    pub fn get_current_time() -> Self {
        let now = time::SystemTime::now();
        let duration = now
            .duration_since(time::UNIX_EPOCH)
            .expect("Time went backwards");
        Self {
            seconds: duration.as_secs() as i64,
            nanos: duration.subsec_nanos() as i32,
        }
    }
}
