Skip to content

Commit 630f957

Browse files
authored
Merge pull request #249 from etactica/milliseconds-from
time: require a type when only milliseconds are supported
2 parents 1d1d2a2 + b9a28b4 commit 630f957

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/time.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ impl Into<KiloHertz> for MegaHertz {
7777
}
7878
}
7979

80-
impl From<u32> for Hertz {
81-
fn from(ms: u32) -> Self {
82-
if ms <= 1000 {
83-
Hertz((1000 + ms / 2) / ms)
80+
impl From<MilliSeconds> for Hertz {
81+
fn from(ms: MilliSeconds) -> Self {
82+
if ms.0 <= 1000 {
83+
Hertz((1000 + ms.0 / 2) / ms.0)
8484
} else {
8585
Hertz(1)
8686
}

0 commit comments

Comments
 (0)