Skip to content

Commit

Permalink
Added additional constructor from millis for 'Delay'
Browse files Browse the repository at this point in the history
  • Loading branch information
jstuczyn committed Nov 9, 2022
1 parent cc8e4a5 commit e05a199
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/header/delays.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ impl Delay {
Delay(value)
}

pub const fn new_from_millis(value: u64) -> Self {
const NANOS_PER_MILLI: u64 = 1_000_000;

Self::new_from_nanos(NANOS_PER_MILLI * value)
}

pub fn to_nanos(&self) -> u64 {
self.0
}
Expand Down

0 comments on commit e05a199

Please sign in to comment.