diff --git a/miosix/_tools/testsuite/testsuite.cpp b/miosix/_tools/testsuite/testsuite.cpp
index 5b2726fc7b0f4f0a8f556a4f2c5d4381ff14dabe..5abbc783dfc3bbe9b9cd84da1c82a45d05f62cfe 100644
--- a/miosix/_tools/testsuite/testsuite.cpp
+++ b/miosix/_tools/testsuite/testsuite.cpp
@@ -910,7 +910,7 @@ static void test_3()
         //tick is in number of ns passed, wakeup time should not differ by > 1ms
         Thread::nanoSleepUntil(tick);
         long long t2 = getTime();
-        if(tick/1000000!=t2/1000000) fail("Thread::sleepUntil()");
+        if((t2-tick)/1000000>0) fail("Thread::sleepUntil()");
         tick+=period;
     }
     pass();