long CSplashScreen::howLongWaitMs() { CTimeInterval endTime = CTimeInterval::getCurrentTime(); long nTimeElapsed = endTime.minus(m_startTime).toULong(); return m_nDelay * 1000 - nTimeElapsed; }
boolean CRhoTimer::checkTimers() { boolean bRet = false; CTimeInterval curTime = CTimeInterval::getCurrentTime(); for( int i = (int)m_arItems.size()-1; i >= 0; i--) { CTimerItem oItem = m_arItems.elementAt(i); if ( curTime.toULong() >= oItem.m_oFireTime.toULong() ) { m_arItems.removeElementAt(i); if ( RHODESAPP().callTimerCallback(oItem.m_strCallback, oItem.m_strCallbackData) ) bRet = true; } } return bRet; }
unsigned long CRhoTimer::getNextTimeout() { if ( m_arItems.size() == 0 ) return 0; CTimeInterval curTime = CTimeInterval::getCurrentTime(); unsigned long nMinInterval = ((unsigned long)-1); for( int i = 0; i < (int)m_arItems.size(); i++ ) { unsigned long nInterval = 0; if ( m_arItems.elementAt(i).m_oFireTime.toULong() > curTime.toULong() ) nInterval = m_arItems.elementAt(i).m_oFireTime.toULong() - curTime.toULong(); if ( nInterval < nMinInterval ) nMinInterval = nInterval; } if ( nMinInterval < 100 ) nMinInterval = 100; return nMinInterval; }
unsigned long CRhoTimer::getNextTimeout() { synchronized(m_mxAccess); if ( (m_arItems.size() == 0) && (m_arNativeItems.size() == 0) ) return 0; CTimeInterval curTime = CTimeInterval::getCurrentTime(); unsigned long nMinInterval = ((unsigned long)-1); for( int i = 0; i < (int)m_arItems.size(); i++ ) { unsigned long nInterval = 0; if ( m_arItems.elementAt(i).m_oFireTime.toULong() > curTime.toULong() ) { nInterval = m_arItems.elementAt(i).m_oFireTime.toULong() - curTime.toULong(); } else { nInterval=nMinInterval+m_arItems.elementAt(i).m_oFireTime.toULong() - curTime.toULong(); } if ( nInterval < nMinInterval ) nMinInterval = nInterval; } for( int i = 0; i < (int)m_arNativeItems.size(); i++ ) { unsigned long nInterval = 0; if ( m_arNativeItems.elementAt(i).m_oFireTime.toULong() > curTime.toULong() ) { nInterval = m_arNativeItems.elementAt(i).m_oFireTime.toULong() - curTime.toULong(); } else { nInterval=nMinInterval+m_arNativeItems.elementAt(i).m_oFireTime.toULong() - curTime.toULong(); } if ( nInterval < nMinInterval ) nMinInterval = nInterval; } if ( nMinInterval < 100 ) nMinInterval = 100; RAWTRACE1("CRhoTimer::getNextTimeout: %d",nMinInterval); return nMinInterval; }
boolean CRhoTimer::checkTimers() { RAWTRACE("CRhoTimer::checkTimers"); synchronized(m_mxAccess); boolean bRet = false; CTimeInterval curTime = CTimeInterval::getCurrentTime(); for( int i = (int)m_arItems.size()-1; i >= 0; i--) { CTimerItem oItem = m_arItems.elementAt(i); if(oItem.m_overflow==false) { if ( curTime.toULong() >= oItem.m_oFireTime.toULong() ) { RAWTRACE("CRhoTimer::checkTimers: firing timer"); m_arItems.removeElementAt(i); if ( RHODESAPP().callTimerCallback(oItem.m_strCallback, oItem.m_strCallbackData) ) bRet = true; } } else { if ( curTime.toULong() >= oItem.m_oFireTime.toULong() ) { if((curTime.toULong()-oItem.m_oFireTime.toULong())<=oItem.m_nInterval) { RAWTRACE("CRhoTimer::checkTimers: firing timer"); m_arItems.removeElementAt(i); if ( RHODESAPP().callTimerCallback(oItem.m_strCallback, oItem.m_strCallbackData) ) bRet = true; } } } } for( int i = (int)m_arNativeItems.size()-1; i >= 0; i--) { CNativeTimerItem oItem = m_arNativeItems.elementAt(i); if(oItem.m_overflow==false) { if ( curTime.toULong() >= oItem.m_oFireTime.toULong() ) { RAWTRACE("CRhoTimer::checkTimers: firing native timer"); m_arNativeItems.removeElementAt(i); if ( oItem.m_pCallback->onTimer() ) bRet = true; } } else { if ( curTime.toULong() >= oItem.m_oFireTime.toULong() ) { if((curTime.toULong()-oItem.m_oFireTime.toULong())<=oItem.m_nInterval) { RAWTRACE("CRhoTimer::checkTimers: firing native timer"); m_arNativeItems.removeElementAt(i); if ( oItem.m_pCallback->onTimer() ) bRet = true; } } } } return bRet; }