diff options
author | Tofu Linden <tofu.linden@lindenlab.com> | 2010-02-06 18:59:44 +0000 |
---|---|---|
committer | Tofu Linden <tofu.linden@lindenlab.com> | 2010-02-06 18:59:44 +0000 |
commit | 4c7ae59996c2743152928abd81831a2ab5e788b6 (patch) | |
tree | 859da5352251011da9b194a5c7caaa20f6330125 /indra/llcommon/lltimer.cpp | |
parent | dfdd4a5e7ca9f8f95cb8d6739176d2aeb826baca (diff) |
move LLEventTimer into its own source module. everyone includes it, almost no-one wants it. now I can dick with it a bit without rebuilding the world, at least. :)
Diffstat (limited to 'indra/llcommon/lltimer.cpp')
-rw-r--r-- | indra/llcommon/lltimer.cpp | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/indra/llcommon/lltimer.cpp b/indra/llcommon/lltimer.cpp index 900e122ea5..25b768079b 100644 --- a/indra/llcommon/lltimer.cpp +++ b/indra/llcommon/lltimer.cpp @@ -555,59 +555,3 @@ void secondsToTimecodeString(F32 current_time, std::string& tcstring) } -////////////////////////////////////////////////////////////////////////////// -// -// LLEventTimer Implementation -// -////////////////////////////////////////////////////////////////////////////// -bool LLEventTimer::sInTickLoop = false; - -LLEventTimer::LLEventTimer(F32 period) -: mEventTimer() -{ - mPeriod = period; -} - -LLEventTimer::LLEventTimer(const LLDate& time) -: mEventTimer() -{ - mPeriod = (F32)(time.secondsSinceEpoch() - LLDate::now().secondsSinceEpoch()); -} - - -LLEventTimer::~LLEventTimer() -{ - llassert(!LLEventTimer::sInTickLoop); // this LLEventTimer was destroyed from within its own tick() function - bad. if you want tick() to cause destruction of its own timer, make it return true. -} - -//static -void LLEventTimer::updateClass() -{ - std::list<LLEventTimer*> completed_timers; - LLEventTimer::sInTickLoop = true; - for (instance_iter iter = beginInstances(); iter != endInstances(); ) - { - LLEventTimer& timer = *iter++; - F32 et = timer.mEventTimer.getElapsedTimeF32(); - if (timer.mEventTimer.getStarted() && et > timer.mPeriod) { - timer.mEventTimer.reset(); - if ( timer.tick() ) - { - completed_timers.push_back( &timer ); - } - } - } - LLEventTimer::sInTickLoop = false; - - if ( completed_timers.size() > 0 ) - { - for (std::list<LLEventTimer*>::iterator completed_iter = completed_timers.begin(); - completed_iter != completed_timers.end(); - completed_iter++ ) - { - delete *completed_iter; - } - } -} - - |