pub struct TimingUtils { /* private fields */ }Expand description
High-precision clock for timing operations
Implementations§
Source§impl TimingUtils
impl TimingUtils
Sourcepub fn now_nanos(&self) -> u64
pub fn now_nanos(&self) -> u64
Get current timestamp in nanoseconds since Unix epoch Uses SystemTime for actual epoch timestamps (not monotonic time)
Sourcepub fn now_millis(&self) -> u64
pub fn now_millis(&self) -> u64
Get current timestamp in milliseconds since Unix epoch
Sourcepub fn now_seconds(&self) -> u64
pub fn now_seconds(&self) -> u64
Get current timestamp in seconds since Unix epoch
Sourcepub fn monotonic_nanos(&self) -> u64
pub fn monotonic_nanos(&self) -> u64
Get monotonic timestamp in nanoseconds since program start Use this for performance measurements, durations, and intervals WARNING: This is NOT epoch time - do not use for persistence or external APIs
Sourcepub fn monotonic_millis(&self) -> u64
pub fn monotonic_millis(&self) -> u64
Get monotonic timestamp in milliseconds since program start Use this for performance measurements, durations, and intervals WARNING: This is NOT epoch time - do not use for persistence or external APIs
Sourcepub fn system_time_to_nanos(time: SystemTime) -> u64
pub fn system_time_to_nanos(time: SystemTime) -> u64
Convert system time to nanoseconds since Unix epoch
Delegates to rusty_common::time::system_time_to_nanos for consistent error handling across the entire system.
Sourcepub fn current_date_string() -> String
pub fn current_date_string() -> String
Get current date string in YYYYMMDD format
Sourcepub fn current_datetime_string() -> String
pub fn current_datetime_string() -> String
Get current datetime string in ISO format
Sourcepub fn is_new_day(
last_timestamp_nanos: u64,
current_timestamp_nanos: u64,
) -> bool
pub fn is_new_day( last_timestamp_nanos: u64, current_timestamp_nanos: u64, ) -> bool
Check if it’s a new day (for file rotation)
Sourcepub fn nanos_to_date_string(timestamp_nanos: u64) -> String
pub fn nanos_to_date_string(timestamp_nanos: u64) -> String
Convert nanoseconds timestamp to date string
Sourcepub fn nanos_to_datetime_string(timestamp_nanos: u64) -> String
pub fn nanos_to_datetime_string(timestamp_nanos: u64) -> String
Convert nanoseconds timestamp to datetime string
Sourcepub fn days_ago(days: u32) -> SimpleDate
pub fn days_ago(days: u32) -> SimpleDate
Get date that is N days ago from now