diff options
Diffstat (limited to 'embassy-time/src/duration.rs')
| -rw-r--r-- | embassy-time/src/duration.rs | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/embassy-time/src/duration.rs b/embassy-time/src/duration.rs index b3ea0468d..b2bfd6de9 100644 --- a/embassy-time/src/duration.rs +++ b/embassy-time/src/duration.rs | |||
| @@ -175,13 +175,7 @@ impl Duration { | |||
| 175 | /// NOTE: Giving this function a hz >= the TICK_HZ of your platform will clamp the Duration to 1 | 175 | /// NOTE: Giving this function a hz >= the TICK_HZ of your platform will clamp the Duration to 1 |
| 176 | /// tick. Doing so will not deadlock, but will certainly not produce the desired output. | 176 | /// tick. Doing so will not deadlock, but will certainly not produce the desired output. |
| 177 | pub const fn from_hz(hz: u64) -> Duration { | 177 | pub const fn from_hz(hz: u64) -> Duration { |
| 178 | let ticks = { | 178 | let ticks = { if hz >= TICK_HZ { 1 } else { (TICK_HZ + hz / 2) / hz } }; |
| 179 | if hz >= TICK_HZ { | ||
| 180 | 1 | ||
| 181 | } else { | ||
| 182 | (TICK_HZ + hz / 2) / hz | ||
| 183 | } | ||
| 184 | }; | ||
| 185 | Duration { ticks } | 179 | Duration { ticks } |
| 186 | } | 180 | } |
| 187 | 181 | ||
