diff --git a/modules/ca/src/client/CASG.cpp b/modules/ca/src/client/CASG.cpp index b2dbaac4d..4ffb414c7 100644 --- a/modules/ca/src/client/CASG.cpp +++ b/modules/ca/src/client/CASG.cpp @@ -83,7 +83,7 @@ int CASG::block ( return ECA_TIMEOUT; } - cur_time = epicsTime::getCurrent (); + cur_time = epicsTime::getMonotonic (); this->client.flush ( guard ); @@ -121,7 +121,7 @@ int CASG::block ( /* * force a time update */ - cur_time = epicsTime::getCurrent (); + cur_time = epicsTime::getMonotonic (); delay = cur_time - beg_time; } diff --git a/modules/ca/src/client/ca_client_context.cpp b/modules/ca/src/client/ca_client_context.cpp index 2bb3e24a8..3305e8d3e 100644 --- a/modules/ca/src/client/ca_client_context.cpp +++ b/modules/ca/src/client/ca_client_context.cpp @@ -481,7 +481,7 @@ int ca_client_context::pendIO ( const double & timeout ) } int status = ECA_NORMAL; - epicsTime beg_time = epicsTime::getCurrent (); + epicsTime beg_time = epicsTime::getMonotonic (); double remaining = timeout; epicsGuard < epicsMutex > guard ( this->mutex ); @@ -499,7 +499,7 @@ int ca_client_context::pendIO ( const double & timeout ) this->blockForEventAndEnableCallbacks ( this->ioDone, remaining ); } - double delay = epicsTime::getCurrent () - beg_time; + double delay = epicsTime::getMonotonic () - beg_time; if ( delay < timeout ) { remaining = timeout - delay; } @@ -528,7 +528,7 @@ int ca_client_context::pendEvent ( const double & timeout ) return ECA_EVDISALLOW; } - epicsTime current = epicsTime::getCurrent (); + epicsTime current = epicsTime::getMonotonic (); { epicsGuard < epicsMutex > guard ( this->mutex ); @@ -569,7 +569,7 @@ int ca_client_context::pendEvent ( const double & timeout ) this->noWakeupSincePend = true; } - double elapsed = epicsTime::getCurrent() - current; + double elapsed = epicsTime::getMonotonic() - current; double delay; if ( timeout > elapsed ) { diff --git a/modules/ca/src/client/cac.cpp b/modules/ca/src/client/cac.cpp index 5748353bd..485b83d89 100644 --- a/modules/ca/src/client/cac.cpp +++ b/modules/ca/src/client/cac.cpp @@ -130,7 +130,7 @@ cac::cac ( epicsMutex & callbackControlIn, cacContextNotify & notifyIn ) : _refLocalHostName ( localHostNameCache.getReference () ), - programBeginTime ( epicsTime::getCurrent() ), + programBeginTime ( epicsTime::getMonotonic() ), connTMO ( CA_CONN_VERIFY_PERIOD ), mutex ( mutualExclusionIn ), cbMutex ( callbackControlIn ), diff --git a/modules/ca/src/client/casw.cpp b/modules/ca/src/client/casw.cpp index f69632c13..bdb08e04d 100644 --- a/modules/ca/src/client/casw.cpp +++ b/modules/ca/src/client/casw.cpp @@ -59,7 +59,7 @@ int main ( int argc, char ** argv ) epicsMutex mutex; epicsGuard < epicsMutex > guard ( mutex ); bheFreeStoreMgr bheFreeList; - epicsTime programBeginTime = epicsTime::getCurrent (); + epicsTime programBeginTime = epicsTime::getMonotonic (); bool validCommandLine = false; unsigned interest = 0u; SOCKET sock; @@ -244,7 +244,7 @@ int main ( int argc, char ** argv ) ca_uint32_t beaconNumber = ntohl ( pCurMsg->m_cid ); unsigned protocolRevision = ntohs ( pCurMsg->m_dataType ); - epicsTime currentTime = epicsTime::getCurrent(); + epicsTime currentTime = epicsTime::getMonotonic(); /* * look for it in the hash table diff --git a/modules/ca/src/client/searchTimer.cpp b/modules/ca/src/client/searchTimer.cpp index e55e49eab..bb9b9a91c 100644 --- a/modules/ca/src/client/searchTimer.cpp +++ b/modules/ca/src/client/searchTimer.cpp @@ -43,7 +43,7 @@ searchTimer::searchTimer ( const unsigned indexIn, epicsMutex & mutexIn, bool boostPossibleIn ) : - timeAtLastSend ( epicsTime::getCurrent () ), + timeAtLastSend ( epicsTime::getMonotonic () ), timer ( queueIn.createTimer () ), iiu ( iiuIn ), mutex ( mutexIn ), diff --git a/modules/ca/src/client/tcpiiu.cpp b/modules/ca/src/client/tcpiiu.cpp index 045f8d57e..9d174ab84 100644 --- a/modules/ca/src/client/tcpiiu.cpp +++ b/modules/ca/src/client/tcpiiu.cpp @@ -476,7 +476,7 @@ void tcpRecvThread::run () statusWireIO stat; pComBuf->fillFromWire ( this->iiu, stat ); - epicsTime currentTime = epicsTime::getCurrent (); + epicsTime currentTime = epicsTime::getMonotonic (); { epicsGuard < epicsMutex > guard ( this->iiu.mutex ); @@ -1669,7 +1669,7 @@ bool tcpiiu::sendThreadFlush ( epicsGuard < epicsMutex > & guard ) if ( this->sendQue.occupiedBytes() > 0 ) { while ( comBuf * pBuf = this->sendQue.popNextComBufToSend () ) { - epicsTime current = epicsTime::getCurrent (); + epicsTime current = epicsTime::getMonotonic (); unsigned bytesToBeSent = pBuf->occupiedBytes (); bool success = false; diff --git a/modules/ca/src/client/udpiiu.cpp b/modules/ca/src/client/udpiiu.cpp index 1bcb03716..c378881f7 100644 --- a/modules/ca/src/client/udpiiu.cpp +++ b/modules/ca/src/client/udpiiu.cpp @@ -435,7 +435,7 @@ void udpRecvThread::run () } else if ( status > 0 ) { this->iiu.postMsg ( src, this->iiu.recvBuf, - (arrayElementCount) status, epicsTime::getCurrent() ); + (arrayElementCount) status, epicsTime::getMonotonic() ); } } while ( ! this->iiu.shutdownCmd ); diff --git a/modules/database/src/ioc/db/dbPutNotifyBlocker.cpp b/modules/database/src/ioc/db/dbPutNotifyBlocker.cpp index 1a796cdbd..2215f8468 100644 --- a/modules/database/src/ioc/db/dbPutNotifyBlocker.cpp +++ b/modules/database/src/ioc/db/dbPutNotifyBlocker.cpp @@ -144,12 +144,12 @@ void dbPutNotifyBlocker::initiatePutNotify ( break; } if ( beginTimeInit ) { - if ( epicsTime::getCurrent () - begin > 30.0 ) { + if ( epicsTime::getMonotonic () - begin > 30.0 ) { throw cacChannel::requestTimedOut (); } } else { - begin = epicsTime::getCurrent (); + begin = epicsTime::getMonotonic (); beginTimeInit = true; } { diff --git a/modules/libcom/src/fdmgr/fdManager.cpp b/modules/libcom/src/fdmgr/fdManager.cpp index 00f4d4a87..f43fab25d 100644 --- a/modules/libcom/src/fdmgr/fdManager.cpp +++ b/modules/libcom/src/fdmgr/fdManager.cpp @@ -97,7 +97,7 @@ epicsShareFunc void fdManager::process (double delay) // more than once here so that fd activity get serviced // in a reasonable length of time. // - double minDelay = this->pTimerQueue->process(epicsTime::getCurrent()); + double minDelay = this->pTimerQueue->process(epicsTime::getMonotonic()); if ( minDelay >= delay ) { minDelay = delay; @@ -121,7 +121,7 @@ epicsShareFunc void fdManager::process (double delay) fd_set * pExceptSet = & this->fdSetsPtr[fdrException]; int status = select (this->maxFD, pReadSet, pWriteSet, pExceptSet, &tv); - this->pTimerQueue->process(epicsTime::getCurrent()); + this->pTimerQueue->process(epicsTime::getMonotonic()); if ( status > 0 ) { @@ -204,7 +204,7 @@ epicsShareFunc void fdManager::process (double delay) * of select() */ epicsThreadSleep(minDelay); - this->pTimerQueue->process(epicsTime::getCurrent()); + this->pTimerQueue->process(epicsTime::getMonotonic()); } this->processInProg = false; return; diff --git a/modules/libcom/src/osi/epicsThread.cpp b/modules/libcom/src/osi/epicsThread.cpp index 892d73de0..da7116476 100644 --- a/modules/libcom/src/osi/epicsThread.cpp +++ b/modules/libcom/src/osi/epicsThread.cpp @@ -143,7 +143,7 @@ bool epicsThread::exitWait ( const double delay ) throw () } return true; } - epicsTime exitWaitBegin = epicsTime::getCurrent (); + epicsTime exitWaitBegin = epicsTime::getMonotonic (); double exitWaitElapsed = 0.0; epicsGuard < epicsMutex > guard ( this->mutex ); this->cancel = true; @@ -151,7 +151,7 @@ bool epicsThread::exitWait ( const double delay ) throw () epicsGuardRelease < epicsMutex > unguard ( guard ); this->event.signal (); this->exitEvent.wait ( delay - exitWaitElapsed ); - epicsTime current = epicsTime::getCurrent (); + epicsTime current = epicsTime::getMonotonic (); exitWaitElapsed = current - exitWaitBegin; } } diff --git a/modules/libcom/src/timer/epicsTimer.cpp b/modules/libcom/src/timer/epicsTimer.cpp index e55280e7e..15bebef7f 100644 --- a/modules/libcom/src/timer/epicsTimer.cpp +++ b/modules/libcom/src/timer/epicsTimer.cpp @@ -173,7 +173,7 @@ extern "C" double epicsShareAPI epicsTimerQueuePassiveProcess ( epicsTimerQueuePassiveId pQueue ) { try { - return pQueue->process ( epicsTime::getCurrent() ); + return pQueue->process ( epicsTime::getMonotonic() ); } catch ( ... ) { return 1.0; diff --git a/modules/libcom/src/timer/epicsTimer.h b/modules/libcom/src/timer/epicsTimer.h index 72270f273..6e054ed4f 100644 --- a/modules/libcom/src/timer/epicsTimer.h +++ b/modules/libcom/src/timer/epicsTimer.h @@ -118,7 +118,7 @@ inline double epicsTimer::getExpireDelay () { epicsTimer::expireInfo info = this->getExpireInfo (); if ( info.active ) { - double delay = info.expireTime - epicsTime::getCurrent (); + double delay = info.expireTime - epicsTime::getMonotonic (); if ( delay < 0.0 ) { delay = 0.0; } diff --git a/modules/libcom/src/timer/timer.cpp b/modules/libcom/src/timer/timer.cpp index 35d6e47bf..6f0c7ea4a 100644 --- a/modules/libcom/src/timer/timer.cpp +++ b/modules/libcom/src/timer/timer.cpp @@ -54,7 +54,7 @@ void timer::destroy () void timer::start ( epicsTimerNotify & notify, double delaySeconds ) { - this->start ( notify, epicsTime::getCurrent () + delaySeconds ); + this->start ( notify, epicsTime::getMonotonic () + delaySeconds ); } void timer::start ( epicsTimerNotify & notify, const epicsTime & expire ) @@ -129,7 +129,7 @@ void timer::privateStart ( epicsTimerNotify & notify, const epicsTime & expire ) debugPrintf ( ("Start of \"%s\" with delay %f at %p preempting %u\n", typeid ( this->notify ).name (), - expire - epicsTime::getCurrent (), + expire - epicsTime::getMonotonic (), this, preemptCount ) ); } @@ -190,7 +190,7 @@ void timer::show ( unsigned int level ) const double delay; if ( this->curState == statePending || this->curState == stateActive ) { try { - delay = this->exp - epicsTime::getCurrent(); + delay = this->exp - epicsTime::getMonotonic(); } catch ( ... ) { delay = - DBL_MAX; diff --git a/modules/libcom/src/timer/timerQueue.cpp b/modules/libcom/src/timer/timerQueue.cpp index 5a798d4d4..d209bcbee 100644 --- a/modules/libcom/src/timer/timerQueue.cpp +++ b/modules/libcom/src/timer/timerQueue.cpp @@ -29,7 +29,7 @@ timerQueue::timerQueue ( epicsTimerQueueNotify & notifyIn ) : pExpireTmr ( 0 ), processThread ( 0 ), exceptMsgTimeStamp ( - epicsTime :: getCurrent () - exceptMsgMinPeriod ), + epicsTime :: getMonotonic () - exceptMsgMinPeriod ), cancelPending ( false ) { } @@ -48,7 +48,7 @@ void timerQueue :: char date[64]; double delay; try { - epicsTime cur = epicsTime :: getCurrent (); + epicsTime cur = epicsTime :: getMonotonic (); delay = cur - this->exceptMsgTimeStamp; cur.strftime ( date, sizeof ( date ), "%a %b %d %Y %H:%M:%S.%f" ); diff --git a/modules/libcom/src/timer/timerQueueActive.cpp b/modules/libcom/src/timer/timerQueueActive.cpp index 5d8b72951..3611f1ad1 100644 --- a/modules/libcom/src/timer/timerQueueActive.cpp +++ b/modules/libcom/src/timer/timerQueueActive.cpp @@ -72,7 +72,7 @@ void timerQueueActive :: _printLastChanceExceptionMessage ( { char date[64]; try { - epicsTime cur = epicsTime :: getCurrent (); + epicsTime cur = epicsTime :: getMonotonic (); cur.strftime ( date, sizeof ( date ), "%a %b %d %Y %H:%M:%S.%f"); } catch ( ... ) { @@ -90,7 +90,7 @@ void timerQueueActive :: run () this->exitFlag = false; while ( ! this->terminateFlag ) { try { - double delay = this->queue.process ( epicsTime::getCurrent() ); + double delay = this->queue.process ( epicsTime::getMonotonic() ); debugPrintf ( ( "timer thread sleeping for %g sec (max)\n", delay ) ); this->rescheduleEvent.wait ( delay ); } diff --git a/modules/libcom/test/cvtFastPerform.cpp b/modules/libcom/test/cvtFastPerform.cpp index c3f99dc61..28c831349 100644 --- a/modules/libcom/test/cvtFastPerform.cpp +++ b/modules/libcom/test/cvtFastPerform.cpp @@ -147,11 +147,11 @@ void Perf :: measure (double srcD, float srcF, int prec) std::memset(buf, 0, sizeof(buf)); - epicsTime beg = epicsTime :: getCurrent (); + epicsTime beg = epicsTime :: getMonotonic (); for ( unsigned i = 0; i < nIterations; i++ ) { c->target (srcD, srcF, buf, sizeof(buf) - 1, prec); } - epicsTime end = epicsTime :: getCurrent (); + epicsTime end = epicsTime :: getMonotonic (); double elapsed = end - beg; elapsed /= nIterations * nUnrolled; diff --git a/modules/libcom/test/epicsAtomicPerform.cpp b/modules/libcom/test/epicsAtomicPerform.cpp index 2ef005efe..98eaf1778 100644 --- a/modules/libcom/test/epicsAtomicPerform.cpp +++ b/modules/libcom/test/epicsAtomicPerform.cpp @@ -394,12 +394,12 @@ static const unsigned N = 10000; void recursiveOwnershipRetPerformance () { RefCtr refCtr; - epicsTime begin = epicsTime::getCurrent (); + epicsTime begin = epicsTime::getMonotonic (); for ( size_t i = 0; i < N; i++ ) { Ownership ownership ( refCtr ); recurRetOwner1000 ( ownership ); } - double delay = epicsTime::getCurrent () - begin; + double delay = epicsTime::getMonotonic () - begin; delay /= N * 1000u; // convert to delay per call delay *= 1e6; // convert to micro seconds testDiag ( "retOwnership() takes %f microseconds", delay ); @@ -408,13 +408,13 @@ void recursiveOwnershipRetPerformance () void ownershipPassRefPerformance () { RefCtr refCtr; - epicsTime begin = epicsTime::getCurrent (); + epicsTime begin = epicsTime::getMonotonic (); for ( size_t i = 0; i < N; i++ ) { Ownership ownershipSrc ( refCtr ); Ownership ownershipDest; passRefOwnership1000 ( ownershipSrc, ownershipDest ); } - double delay = epicsTime::getCurrent () - begin; + double delay = epicsTime::getMonotonic () - begin; delay /= N * 1000u; // convert to delay per call delay *= 1e6; // convert to micro seconds testDiag ( "passRefOwnership() takes %f microseconds", delay ); @@ -456,7 +456,7 @@ void Ten < T > :: diagnostic ( double delay ) template < class T > void measurePerformance () { - epicsTime begin = epicsTime::getCurrent (); + epicsTime begin = epicsTime::getMonotonic (); T target; for ( size_t i = 0; i < N; i++ ) { target.run (); @@ -470,7 +470,7 @@ void measurePerformance () target.run (); target.run (); } - double delay = epicsTime::getCurrent () - begin; + double delay = epicsTime::getMonotonic () - begin; delay /= ( N * 10u ); // convert to delay per call target.diagnostic ( delay ); } diff --git a/modules/libcom/test/epicsEventTest.cpp b/modules/libcom/test/epicsEventTest.cpp index 7c1a24141..b3e48f8f2 100644 --- a/modules/libcom/test/epicsEventTest.cpp +++ b/modules/libcom/test/epicsEventTest.cpp @@ -156,9 +156,9 @@ static void eventWakeupTest(void) static double eventWaitMeasureDelayError( const epicsEventId &id, const double & delay ) { - epicsTime beg = epicsTime::getCurrent(); + epicsTime beg = epicsTime::getMonotonic(); epicsEventWaitWithTimeout ( id, delay ); - epicsTime end = epicsTime::getCurrent(); + epicsTime end = epicsTime::getMonotonic(); double meas = end - beg; double error = fabs ( delay - meas ); testDiag("epicsEventWaitWithTimeout(%.6f) delay error %.6f sec", diff --git a/modules/libcom/test/epicsMutexTest.cpp b/modules/libcom/test/epicsMutexTest.cpp index d44e5c0f1..e3ad5868f 100644 --- a/modules/libcom/test/epicsMutexTest.cpp +++ b/modules/libcom/test/epicsMutexTest.cpp @@ -168,32 +168,32 @@ void epicsMutexPerformance () unsigned i; // test a single lock pair - epicsTime begin = epicsTime::getCurrent (); + epicsTime begin = epicsTime::getMonotonic (); static const unsigned N = 1000; for ( i = 0; i < N; i++ ) { tenLockPairsSquared ( mutex ); } - double delay = epicsTime::getCurrent () - begin; + double delay = epicsTime::getMonotonic () - begin; delay /= N * 100u; // convert to delay per lock pair delay *= 1e6; // convert to micro seconds testDiag("lock()*1/unlock()*1 takes %f microseconds", delay); // test a two times recursive lock pair - begin = epicsTime::getCurrent (); + begin = epicsTime::getMonotonic (); for ( i = 0; i < N; i++ ) { tenDoubleRecursiveLockPairsSquared ( mutex ); } - delay = epicsTime::getCurrent () - begin; + delay = epicsTime::getMonotonic () - begin; delay /= N * 100u; // convert to delay per lock pair delay *= 1e6; // convert to micro seconds testDiag("lock()*2/unlock()*2 takes %f microseconds", delay); // test a four times recursive lock pair - begin = epicsTime::getCurrent (); + begin = epicsTime::getMonotonic (); for ( i = 0; i < N; i++ ) { tenQuadRecursiveLockPairsSquared ( mutex ); } - delay = epicsTime::getCurrent () - begin; + delay = epicsTime::getMonotonic () - begin; delay /= N * 100u; // convert to delay per lock pair delay *= 1e6; // convert to micro seconds testDiag("lock()*4/unlock()*4 takes %f microseconds", delay); diff --git a/modules/libcom/test/epicsThreadPerform.cpp b/modules/libcom/test/epicsThreadPerform.cpp index c8fd34515..b73d90c9e 100644 --- a/modules/libcom/test/epicsThreadPerform.cpp +++ b/modules/libcom/test/epicsThreadPerform.cpp @@ -55,9 +55,9 @@ static void epicsThreadPriorityTest() static double threadSleepMeasureDelayError ( const double & delay ) { - epicsTime beg = epicsTime::getCurrent(); + epicsTime beg = epicsTime::getMonotonic(); epicsThreadSleep ( delay ); - epicsTime end = epicsTime::getCurrent(); + epicsTime end = epicsTime::getMonotonic(); double meas = end - beg; double error = fabs ( delay - meas ); return error; @@ -76,10 +76,10 @@ static double measureSleepQuantum ( double interval = rand (); interval /= RAND_MAX; interval *= testInterval; - epicsTime start = epicsTime::getCurrent (); + epicsTime start = epicsTime::getMonotonic (); epicsTime current = start; while ( current - start < interval ) { - current = epicsTime::getCurrent (); + current = epicsTime::getMonotonic (); } errorSum += threadSleepMeasureDelayError ( testInterval ); if ( i % ( iterations / 10 ) == 0 ) { @@ -150,7 +150,7 @@ static void epicsThreadGetIdSelfPerfTest () { static const unsigned N = 10000; static const double microSecPerSec = 1e6; - epicsTime begin = epicsTime::getCurrent (); + epicsTime begin = epicsTime::getMonotonic (); for ( unsigned i = 0u; i < N; i++ ) { epicsThreadGetIdSelf (); epicsThreadGetIdSelf (); @@ -164,7 +164,7 @@ static void epicsThreadGetIdSelfPerfTest () epicsThreadGetIdSelf (); epicsThreadGetIdSelf (); }; - epicsTime end = epicsTime::getCurrent (); + epicsTime end = epicsTime::getMonotonic (); printf ( "It takes %f micro sec to call epicsThreadGetIdSelf ()\n", microSecPerSec * ( end - begin ) / (10 * N) ); } @@ -204,12 +204,12 @@ static void timeEpicsThreadPrivateGet () { priv.set ( 0 ); - epicsTime begin = epicsTime::getCurrent (); + epicsTime begin = epicsTime::getMonotonic (); static const unsigned N = 1000u; for ( unsigned i = 0u; i < N; i++ ) { callItTenTimesSquared (); } - double delay = epicsTime::getCurrent() - begin; + double delay = epicsTime::getMonotonic() - begin; delay /= N * 100u; // convert to sec per call delay *= 1e6; // convert to micro sec printf("epicsThreadPrivateGet() takes %f microseconds\n", delay); diff --git a/modules/libcom/test/epicsTimerTest.cpp b/modules/libcom/test/epicsTimerTest.cpp index f2a510819..55ce82eeb 100644 --- a/modules/libcom/test/epicsTimerTest.cpp +++ b/modules/libcom/test/epicsTimerTest.cpp @@ -156,7 +156,7 @@ void testAccuracy () expireCount = nTimers; for ( i = 0u; i < nTimers; i++ ) { - epicsTime cur = epicsTime::getCurrent (); + epicsTime cur = epicsTime::getMonotonic (); pTimers[i]->setBegin ( cur ); pTimers[i]->start ( cur + pTimers[i]->delay () ); } @@ -253,7 +253,7 @@ void testCancel () testDiag ( "cancelCount = %u", cancelVerify::cancelCount ); testDiag ( "starting %d timers", nTimers ); - epicsTime exp = epicsTime::getCurrent () + 4.0; + epicsTime exp = epicsTime::getMonotonic () + 4.0; for ( i = 0u; i < nTimers; i++ ) { pTimers[i]->start ( exp ); } @@ -339,7 +339,7 @@ void testExpireDestroy () testOk1 ( expireDestroyVerify::destroyCount == 0 ); testDiag ( "starting %d timers", nTimers ); - epicsTime cur = epicsTime::getCurrent (); + epicsTime cur = epicsTime::getMonotonic (); for ( i = 0u; i < nTimers; i++ ) { pTimers[i]->start ( cur ); } @@ -432,7 +432,7 @@ void testPeriodic () testOk1 ( timerCount == nTimers ); testDiag ( "starting %d timers", nTimers ); - epicsTime cur = epicsTime::getCurrent (); + epicsTime cur = epicsTime::getMonotonic (); for ( i = 0u; i < nTimers; i++ ) { pTimers[i]->start ( cur ); }