1
0
Fork 0

scope the age variable to the function

This commit is contained in:
Kevin Matz 2022-11-28 11:17:35 -05:00
parent 3e77990490
commit 73ee83cd9e
1 changed files with 3 additions and 2 deletions

View File

@ -268,6 +268,7 @@ void Universe::doDataCallbacks()
void Universe::rx_timeout_(bool add_now)
{
auto now = std::chrono::system_clock::now();
auto age = rxAge();
if (add_now)
{
last_seen_ = now;
@ -275,12 +276,12 @@ void Universe::rx_timeout_(bool add_now)
}
auto elapsed = [] (auto& a, auto& b) {
return std::chrono::duration_cast<std::chrono::milliseconds>(a - b);
return std::chrono::duration_cast<std::chrono::milliseconds>(a - b).count();
};
while (!rx_times_.empty())
{
auto age = elapsed(now, rx_times_.front()).count();
age = elapsed(now, rx_times_.front());
if (age < rx_timeout_period_)
break;
else