Skip to content

Commit

Permalink
NetworkClock: close the gap between the waiter and the time if a time…
Browse files Browse the repository at this point in the history
… reset is detected

Co-authored-by: Daniele E. Domenichelli <[email protected]>
  • Loading branch information
Giulero and drdanz authored Mar 7, 2021
1 parent f216964 commit 97ce64d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/libYARP_os/src/yarp/os/NetworkClock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,11 @@ bool NetworkClock::Private::read(ConnectionReader& reader)

listMutex.lock();
auto waiter_it = waiters->begin();
// Update the wake-up time. In case of a time reset it closes the gap between the waiter and _time.
waiter_it->first = _time + (waiter_it->first - oldTime);
if (oldTime > _time) {
// Update the wake-up time. In case of a time reset it closes the gap
// between the waiter and _time.
waiter_it->first = _time + (waiter_it->first - oldTime);
}

while (waiter_it != waiters->end())
{
Expand Down

0 comments on commit 97ce64d

Please sign in to comment.