Function utcnow::utcnow

source ·
pub fn utcnow() -> Result<UtcTime>
Expand description

Get the current unix time, seconds since 1970-01-01 in UTC

Please see the module level documentation for more information.

§Errors

For many target platforms this call cannot fail. If this is true for the current target, then the constant INFALLIBLE will be true. Rust will automatically optimize the unwrap() call into a no-op in this case. Independent of the target platform the Error type will always be Send + Sync + Copy.

§Example

let now = utcnow::utcnow().unwrap();
let seconds = now.as_secs();
let nanos = now.subsec_nanos();