aboutsummaryrefslogtreecommitdiff
path: root/embassy-time/src/duration.rs
diff options
context:
space:
mode:
authormaor1993 <[email protected]>2025-10-07 15:05:09 +0300
committerGitHub <[email protected]>2025-10-07 15:05:09 +0300
commit04a36e9f62385fb4338908de66045f36fec664ea (patch)
tree714fcc21114946e33b2be8eb6037bdc3dd9bb596 /embassy-time/src/duration.rs
parentcd91fe3b30dbb3d5b3c9c7d9e7cb151d721fb8d5 (diff)
parent07016a4ffbe0b0ea689b83a6ddf19ab1b6a9a79a (diff)
Merge branch 'embassy-rs:main' into main
Diffstat (limited to 'embassy-time/src/duration.rs')
-rw-r--r--embassy-time/src/duration.rs8
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