diff --git a/src/runtime/runtime_mimxrt1062_time.go b/src/runtime/runtime_mimxrt1062_time.go index e3779052ff..feaf68dbd4 100644 --- a/src/runtime/runtime_mimxrt1062_time.go +++ b/src/runtime/runtime_mimxrt1062_time.go @@ -119,19 +119,17 @@ func ticks() timeUnit { } func sleepTicks(duration timeUnit) { - if duration >= 0 { - curr := ticks() - last := curr + duration // 64-bit overflow unlikely - for curr < last { - cycles := timeUnit((last - curr) / pitCyclesPerMicro) - if cycles > 0xFFFFFFFF { - cycles = 0xFFFFFFFF - } - if !timerSleep(uint32(cycles)) { - return // return early due to interrupt - } - curr = ticks() + curr := ticks() + last := curr + duration // 64-bit overflow unlikely + for curr < last { + cycles := timeUnit((last - curr) / pitCyclesPerMicro) + if cycles > 0xFFFFFFFF { + cycles = 0xFFFFFFFF } + if !timerSleep(uint32(cycles)) { + return // return early due to interrupt + } + curr = ticks() } } diff --git a/src/runtime/runtime_rp2040.go b/src/runtime/runtime_rp2040.go index fa048117b9..1d36a771e5 100644 --- a/src/runtime/runtime_rp2040.go +++ b/src/runtime/runtime_rp2040.go @@ -31,10 +31,6 @@ func nanosecondsToTicks(ns int64) timeUnit { } func sleepTicks(d timeUnit) { - if d <= 0 { - return - } - if hasScheduler { // With scheduler, sleepTicks may return early if an interrupt or // event fires - so scheduler can schedule any go routines now