Function system_time_to_nanos

Source
pub fn system_time_to_nanos(time: SystemTime) -> u64
Expand description

Convert a specific SystemTime to nanoseconds since Unix epoch

This function takes a SystemTime parameter and converts it to nanoseconds since Unix epoch, with proper error handling consistent with other timestamp functions in this module.

§Arguments

  • time - The SystemTime to convert

§Returns

Nanoseconds since Unix epoch as u64

§Error Handling

When the provided time is before Unix epoch:

  • Logs a critical error
  • Falls back to current system time
  • With panic-on-clock-error feature: Panics on system clock failure
  • Without feature: Returns sentinel value on system clock failure

This provides consistent error handling with other timestamp functions.