Skip to main content

Crate switchy_time

Crate switchy_time 

Source
Expand description

Time utilities with support for both standard system time and simulated time.

This crate provides a unified interface for getting the current time, with the ability to switch between real system time and simulated time for testing purposes. When the simulator feature is enabled, time can be controlled programmatically for deterministic testing.

§Features

  • std - Enables standard library time functions
  • simulator - Enables time simulation capabilities for testing
  • chrono - Adds support for chrono DateTime types

§Examples

use switchy_time::now;
use std::time::SystemTime;

let current_time = now();

Re-exports§

pub use simulator::instant_now;
pub use simulator::now;

Modules§

simulator
Time simulation for deterministic testing.
standard
Standard time functions using real system time.