-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed
Labels
Milestone
Description
In time synchronization if adjust time back, the Timer will waitfor a long time more longer than the periodicInterval.
void Timer::run()
{
Poco::Timestamp now;
long interval(0);
do
{
long sleep(0);
do
{
now.update();
sleep = static_cast<long>((_nextInvocation - now)/1000);
if (sleep < 0)
{
if (interval == 0)
{
sleep = 0;
break;
}
_nextInvocation += static_cast<Timestamp::TimeVal>(interval)*1000;
++_skipped;
}
}
while (sleep < 0);
if (_wakeUp.tryWait(sleep)) //if system time be adjusted back tryWait function will trap in a long wait
//Should this line be change to
if (_wakeUp.tryWait(sleep>getPeriodicInterval()?getPeriodicInterval():sleep))
.......Reactions are currently unavailable