[test] update AdvanceTime() in unit tests to handle overflow (#8244)

This commit is contained in:
Abtin Keshavarzian
2022-10-06 08:54:27 -07:00
committed by GitHub
parent 10de4c4f13
commit 4eb64510bf
3 changed files with 6 additions and 3 deletions
+2 -1
View File
@@ -39,6 +39,7 @@
#include "common/array.hpp"
#include "common/instance.hpp"
#include "common/string.hpp"
#include "common/time.hpp"
#if OPENTHREAD_CONFIG_SRP_SERVER_ENABLE && OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE && \
!OPENTHREAD_CONFIG_TIME_SYNC_ENABLE && !OPENTHREAD_PLATFORM_POSIX
@@ -179,7 +180,7 @@ void AdvanceTime(uint32_t aDuration)
Log("AdvanceTime for %u.%03u", aDuration / 1000, aDuration % 1000);
while (sAlarmTime <= time)
while (TimeMilli(sAlarmTime) <= TimeMilli(time))
{
ProcessRadioTxAndTasklets();
sNow = sAlarmTime;