You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original:
long Timeval::delta(const Timeval& other) const
{
// 2^31 milliseconds is just over 4 years.
long deltaS = other.sec() - sec();
long deltaUs = other.usec() - usec();
return 1000*deltaS + deltaUs/1000;
}
should Be:
long Timeval::delta(const Timeval& other) const
{
// 2^31 milliseconds is just over 4 years.
long deltaS = (long)other.sec() - (long)sec();
long deltaUs = (long)other.usec() - (long)usec();
return 1000*deltaS + deltaUs/1000;
}
Reason:
usec() return uint32_t type, which will result in (1-2) > 0, deltaUs will be wrong!!!
The text was updated successfully, but these errors were encountered:
Original:
long Timeval::delta(const Timeval& other) const
{
// 2^31 milliseconds is just over 4 years.
long deltaS = other.sec() - sec();
long deltaUs = other.usec() - usec();
return 1000*deltaS + deltaUs/1000;
}
should Be:
long Timeval::delta(const Timeval& other) const
{
// 2^31 milliseconds is just over 4 years.
long deltaS = (long)other.sec() - (long)sec();
long deltaUs = (long)other.usec() - (long)usec();
return 1000*deltaS + deltaUs/1000;
}
Reason:
usec() return uint32_t type, which will result in (1-2) > 0, deltaUs will be wrong!!!
The text was updated successfully, but these errors were encountered: