time: some const fns

This commit is contained in:
Dario Nieuwenhuis 2020-10-19 21:21:43 +02:00
parent ec4b95579d
commit a2e73cb549
2 changed files with 6 additions and 2 deletions

View file

@ -8,7 +8,7 @@ pub struct Duration {
} }
impl Duration { impl Duration {
pub fn into_ticks(&self) -> u32 { pub const fn into_ticks(&self) -> u32 {
self.ticks self.ticks
} }

View file

@ -17,7 +17,11 @@ impl Instant {
Instant { ticks: now() } Instant { ticks: now() }
} }
pub fn into_ticks(&self) -> u64 { pub const fn from_ticks(ticks: u64) -> Self {
Self { ticks }
}
pub const fn into_ticks(&self) -> u64 {
self.ticks self.ticks
} }