[][src]Module cala::when

API for getting the date and time of day.

Getting Started

use cala::when::{Clock, SECOND};

// Print current Local time and UTC time.
let clock = Clock::new();
println!("Local: {}", clock);
println!("UTC:   {:?}", clock);

// Print 'Hello, world #!' every 1/3 seconds
let mut a = 0;
loop {
    let now = Clock::new();
    let b = now.since(&clock, SECOND / 3);
    if a != b {
        a = b;
        println!("Hello, world {}!", a);
    }
}

Structs

Clock

A calendar date and time. Stored as UTC.

Duration

An amount of time.

Enums

DayOfWeek

Which day of the week.

Month

Month of the year.

Constants

DAY

1 day.

HOUR

1 hour.

MICROSECOND

1 microsecond.

MILLISECOND

1 millisecond.

MINUTE

1 minute.

NANOSECOND

1 nanosecond.

SECOND

1 second.