Skip to main content

feldera_types/transport/
clock.rs

1use std::cmp::max;
2
3use serde::{Deserialize, Serialize};
4use utoipa::ToSchema;
5
6#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize, ToSchema)]
7pub struct ClockConfig {
8    pub clock_resolution_usecs: u64,
9}
10
11impl ClockConfig {
12    pub fn clock_resolution_ms(&self) -> u64 {
13        // Refuse to set 0 clock resolution.
14        max((self.clock_resolution_usecs + 500) / 1_000, 1)
15    }
16}