summaryrefslogtreecommitdiff
path: root/indra/llcommon/llframetimer.cpp
diff options
context:
space:
mode:
authorJosh Bell <josh@lindenlab.com>2007-03-31 01:41:19 +0000
committerJosh Bell <josh@lindenlab.com>2007-03-31 01:41:19 +0000
commitea8fb7238e6f12383ee4bc081475fa6235637581 (patch)
treef384da93c884353bef55cf887f6c86f2081db271 /indra/llcommon/llframetimer.cpp
parentffc6680d956069625fc1fe5da133bdf7922cea83 (diff)
svn merge -r 59364:59813 svn+ssh://svn.lindenlab.com/svn/linden/branches/maintenance --> release
Diffstat (limited to 'indra/llcommon/llframetimer.cpp')
-rw-r--r--indra/llcommon/llframetimer.cpp44
1 files changed, 44 insertions, 0 deletions
diff --git a/indra/llcommon/llframetimer.cpp b/indra/llcommon/llframetimer.cpp
index c66410651f..fca2bd2e85 100644
--- a/indra/llcommon/llframetimer.cpp
+++ b/indra/llcommon/llframetimer.cpp
@@ -33,6 +33,50 @@ void LLFrameTimer::updateFrameTime()
sFrameCount++;
}
+void LLFrameTimer::start()
+{
+ reset();
+ mStarted = TRUE;
+}
+
+void LLFrameTimer::stop()
+{
+ mStarted = FALSE;
+}
+
+void LLFrameTimer::reset()
+{
+ mStartTime = sFrameTime;
+ mExpiry = sFrameTime;
+}
+
+// Don't combine pause/unpause with start/stop
+// Useage:
+// LLFrameTime foo; // starts automatically
+// foo.unpause(); // noop but safe
+// foo.pause(); // pauses timer
+// foo.unpause() // unpauses
+// F32 elapsed = foo.getElapsedTimeF32() // does not include time between pause() and unpause()
+// Note: elapsed would also be valid with no unpause() call (= time run until pause() called)
+void LLFrameTimer::pause()
+{
+ if (mStarted)
+ mStartTime = sFrameTime - mStartTime; // save dtime
+ mStarted = FALSE;
+}
+
+void LLFrameTimer::unpause()
+{
+ if (!mStarted)
+ mStartTime = sFrameTime - mStartTime; // restore dtime
+ mStarted = TRUE;
+}
+
+void LLFrameTimer::setTimerExpirySec(F32 expiration)
+{
+ mExpiry = expiration + mStartTime;
+}
+
void LLFrameTimer::setExpiryAt(F64 seconds_since_epoch)
{
mStartTime = sFrameTime;