aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llcommon/llframetimer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llcommon/llframetimer.cpp')
-rw-r--r--linden/indra/llcommon/llframetimer.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/linden/indra/llcommon/llframetimer.cpp b/linden/indra/llcommon/llframetimer.cpp
index d41f904..5ae4a6b 100644
--- a/linden/indra/llcommon/llframetimer.cpp
+++ b/linden/indra/llcommon/llframetimer.cpp
@@ -3,6 +3,7 @@
3 * 3 *
4 * Copyright (c) 2002-2007, Linden Research, Inc. 4 * Copyright (c) 2002-2007, Linden Research, Inc.
5 * 5 *
6 * Second Life Viewer Source Code
6 * The source code in this file ("Source Code") is provided by Linden Lab 7 * The source code in this file ("Source Code") is provided by Linden Lab
7 * to you under the terms of the GNU General Public License, version 2.0 8 * to you under the terms of the GNU General Public License, version 2.0
8 * ("GPL"), unless you have obtained a separate licensing agreement 9 * ("GPL"), unless you have obtained a separate licensing agreement
@@ -52,6 +53,50 @@ void LLFrameTimer::updateFrameTime()
52 sFrameCount++; 53 sFrameCount++;
53} 54}
54 55
56void LLFrameTimer::start()
57{
58 reset();
59 mStarted = TRUE;
60}
61
62void LLFrameTimer::stop()
63{
64 mStarted = FALSE;
65}
66
67void LLFrameTimer::reset()
68{
69 mStartTime = sFrameTime;
70 mExpiry = sFrameTime;
71}
72
73// Don't combine pause/unpause with start/stop
74// Useage:
75// LLFrameTime foo; // starts automatically
76// foo.unpause(); // noop but safe
77// foo.pause(); // pauses timer
78// foo.unpause() // unpauses
79// F32 elapsed = foo.getElapsedTimeF32() // does not include time between pause() and unpause()
80// Note: elapsed would also be valid with no unpause() call (= time run until pause() called)
81void LLFrameTimer::pause()
82{
83 if (mStarted)
84 mStartTime = sFrameTime - mStartTime; // save dtime
85 mStarted = FALSE;
86}
87
88void LLFrameTimer::unpause()
89{
90 if (!mStarted)
91 mStartTime = sFrameTime - mStartTime; // restore dtime
92 mStarted = TRUE;
93}
94
95void LLFrameTimer::setTimerExpirySec(F32 expiration)
96{
97 mExpiry = expiration + mStartTime;
98}
99
55void LLFrameTimer::setExpiryAt(F64 seconds_since_epoch) 100void LLFrameTimer::setExpiryAt(F64 seconds_since_epoch)
56{ 101{
57 mStartTime = sFrameTime; 102 mStartTime = sFrameTime;