Skip to main content

time

Macro time 

Source
time!() { /* proc-macro */ }
Expand description

Returns the compile time as time::Time.

By default, the returned time is in UTC, call time!(local) to return the local time.

ยงExample

Get the UTC time:

const COMPILE_TIME: time::Time = compile_time::time!();

let hour = COMPILE_TIME.hour();
let minute = COMPILE_TIME.minute();
let second = COMPILE_TIME.second();
println!("Compiled at {hour:02}:{minute:02}:{second:02}.");

Get the time for the local time zone:

const COMPILE_TIME: time::Time = compile_time::time!(local);

let hour = COMPILE_TIME.hour();
let minute = COMPILE_TIME.minute();
let second = COMPILE_TIME.second();
println!("Compiled at {hour:02}:{minute:02}:{second:02}.");