[simulation] fix the wrong timeout value issue (#7262)

When the type `time_t` is 32 bits wide, the current code will truncate
the value of time and returns a wrong value.
This commit is contained in:
Zhanglong Xia
2022-01-09 21:48:25 -08:00
committed by GitHub
parent 442b7e82f6
commit b69aac4aa8
+1 -1
View File
@@ -270,7 +270,7 @@ void platformAlarmUpdateTimeout(struct timeval *aTimeout)
remaining = 1;
}
aTimeout->tv_sec = (time_t)remaining / US_PER_S;
aTimeout->tv_sec = (time_t)(remaining / US_PER_S);
aTimeout->tv_usec = remaining % US_PER_S;
}
}