void DelayedNodeWatcher::update(const ds::UpdateParams & p){ Poco::Timestamp::TimeVal nowwy = Poco::Timestamp().epochMicroseconds(); float delty = (float)(nowwy - mLastQueryTime) / 1000000.0f; if(mNeedQuery && delty > mDelayWaitTime){ mNeedQuery = false; if(mDelayedNodeCallback) mDelayedNodeCallback(); mLastQueryTime = nowwy; } }
void DelayedNodeWatcher::update(const ds::UpdateParams & p){ Poco::Timestamp::TimeVal nowwy = Poco::Timestamp().epochMicroseconds(); float delty = (float)(nowwy - mLastQueryTime) / 1000000.0f; if(mNeedQuery && delty > mDelayWaitTime){ mNeedQuery = false; mLastQueryTime = nowwy; if(mDelayedMessageNodeCallback){ // send all the stored messages for(auto it = mDelayedMessages.begin(); it != mDelayedMessages.end(); it++){ mDelayedMessageNodeCallback(*it); } } mDelayedMessages.clear(); if(mDelayedNodeCallback){ mDelayedNodeCallback(); } } }