Skip to content

Commit 0582896

Browse files
committed
zephyr-core: time: helper for creating a DurationMs
1 parent 54f0910 commit 0582896

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

rust/zephyr-core/src/time.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ impl From<InstantMs> for Duration {
5555
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash, From, Into)]
5656
pub struct DurationMs(i32);
5757

58+
impl DurationMs {
59+
pub fn new(ms: i32) -> Self {
60+
DurationMs(ms)
61+
}
62+
}
63+
5864
impl From<DurationMs> for Duration {
5965
fn from(dur: DurationMs) -> Self {
6066
let secs = dur.0 / 1000;

0 commit comments

Comments
 (0)