utcnow 0.2.0

Get the current unixtime in a no-std context
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use quickcheck::{Arbitrary, Gen};

use crate::UtcTime;

impl Arbitrary for UtcTime {
    fn arbitrary(gen: &mut Gen) -> Self {
        let (secs, nanos) = <(i64, u32)>::arbitrary(gen);
        let nanos = nanos % 1_000_000_000;
        unsafe { UtcTime::create(secs, nanos) }
    }
}

#[cfg(all(test, not(miri)))]
#[quickcheck_macros::quickcheck]
fn minimal_test(value: UtcTime) {
    assert!(value.nanos.get() < 1_000_000_000);
}