[timer] fix elapsed overflow (#3789)

This commit fixes a bug in the commissioner when a joiner's expiration
time has alerady elapsed.

This commit also introduces convenience methods for computing time
elapsed and diffs.
This commit is contained in:
Yakun Xu
2019-05-02 23:44:37 +08:00
committed by Jonathan Hui
parent 267a3b3e29
commit ae4ef9eb3e
19 changed files with 126 additions and 64 deletions
+1 -1
View File
@@ -2011,7 +2011,7 @@ void Interpreter::HandleIcmpReceive(Message & aMessage,
if (aMessage.Read(aMessage.GetOffset(), sizeof(uint32_t), &timestamp) >= static_cast<int>(sizeof(uint32_t)))
{
mServer->OutputFormat(" time=%dms", TimerMilli::GetNow() - HostSwap32(timestamp));
mServer->OutputFormat(" time=%dms", TimerMilli::Elapsed(HostSwap32(timestamp)));
}
mServer->OutputFormat("\r\n");