Calendar

Provides basic primitives to work with time-related operations.

  • Time: Clock time with nanosecond precision.
  • Date: Proleptic Gregorian calendar. Can represent years from -32767 to 32766.
  • DateTime: ISO-8601 representation without timezones.

To use this functionality, it is necessary to activate the calendar feature.

Example

//! Basic time operation.

extern crate wtx;

use wtx::calendar::{Duration, Instant};

fn main() -> wtx::Result<()> {
  println!(
    "ISO 8601 representation of the next 2 minutes in UTC: {}",
    Instant::now_date_time(0)?.add(Duration::from_minutes(2)?)?
  );
  Ok(())
}