Calendar
Provides basic primitives to work with time-related operations.
-
Date
: Proleptic Gregorian calendar. Can represent years from -32767 to 32766. -
DateTime
: ISO-8601 representation with timezones. -
Duration
: Time span in nanoseconds. Can be negative unlikecore::time::Duration
. -
Instant
: A specific point in time. Contains the underlying mechanism that provides a timestamp. -
Time
Clock time with nanosecond precision.
Also supports arithmetic operations and flexible formatting.
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(()) }