38 lines
650 B
Rust
38 lines
650 B
Rust
|
#![no_std]
|
||
|
|
||
|
use versioning::Version;
|
||
|
pub const VERSION: Version = Version::new(0, 1, 0);
|
||
|
|
||
|
pub struct Time {
|
||
|
pub secs: u64,
|
||
|
pub nanos: u32,
|
||
|
}
|
||
|
impl Time {
|
||
|
pub fn now() -> Time {
|
||
|
let secs = 0;
|
||
|
let nanos = 0;
|
||
|
Time { secs, nanos }
|
||
|
}
|
||
|
|
||
|
pub fn elapsed(&self) -> TimeDuration {
|
||
|
let secs = 0;
|
||
|
let nanos = 0;
|
||
|
TimeDuration { secs, nanos }
|
||
|
}
|
||
|
}
|
||
|
|
||
|
pub struct TimeDuration {
|
||
|
pub secs: u64,
|
||
|
pub nanos: u32,
|
||
|
}
|
||
|
|
||
|
impl TimeDuration {
|
||
|
pub fn from_secs(secs: u64) -> TimeDuration {
|
||
|
TimeDuration { secs, nanos: 0 }
|
||
|
}
|
||
|
|
||
|
pub fn as_secs(&self) -> u64 {
|
||
|
self.secs
|
||
|
}
|
||
|
}
|