18 lines
599 B
Rust
18 lines
599 B
Rust
//! Linux adapter for the common durable signed reconciliation state machine.
|
|
//! The existing Linux native clock and OpenSSL verification profile remain.
|
|
use anyhow::{Result, ensure};
|
|
use chrono::{DateTime, Utc};
|
|
pub use rmm_agent_core::reconcile::*;
|
|
pub struct NativeClock(rmm_privileged_helper::TrustedClock);
|
|
impl Default for NativeClock {
|
|
fn default() -> Self {
|
|
Self(rmm_privileged_helper::TrustedClock::new())
|
|
}
|
|
}
|
|
impl SyncClock for NativeClock {
|
|
fn now(&self) -> Result<DateTime<Utc>> {
|
|
ensure!(self.0.trusted(), "CLOCK_UNTRUSTED");
|
|
Ok(Utc::now())
|
|
}
|
|
}
|