diff options
author | Jacek Antonelli | 2008-08-15 23:44:54 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:54 -0500 |
commit | b2afb8800bb033a04bb3ecdf0363068d56648ef1 (patch) | |
tree | 3568129b5bbddb47cd39d622b4137a8fbff4abaf /linden/indra/llcommon/llframetimer.cpp | |
parent | Second Life viewer sources 1.14.0.1 (diff) | |
download | meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.zip meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.tar.gz meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.tar.bz2 meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.tar.xz |
Second Life viewer sources 1.15.0.2
Diffstat (limited to 'linden/indra/llcommon/llframetimer.cpp')
-rw-r--r-- | linden/indra/llcommon/llframetimer.cpp | 45 |
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 | ||
56 | void LLFrameTimer::start() | ||
57 | { | ||
58 | reset(); | ||
59 | mStarted = TRUE; | ||
60 | } | ||
61 | |||
62 | void LLFrameTimer::stop() | ||
63 | { | ||
64 | mStarted = FALSE; | ||
65 | } | ||
66 | |||
67 | void 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) | ||
81 | void LLFrameTimer::pause() | ||
82 | { | ||
83 | if (mStarted) | ||
84 | mStartTime = sFrameTime - mStartTime; // save dtime | ||
85 | mStarted = FALSE; | ||
86 | } | ||
87 | |||
88 | void LLFrameTimer::unpause() | ||
89 | { | ||
90 | if (!mStarted) | ||
91 | mStartTime = sFrameTime - mStartTime; // restore dtime | ||
92 | mStarted = TRUE; | ||
93 | } | ||
94 | |||
95 | void LLFrameTimer::setTimerExpirySec(F32 expiration) | ||
96 | { | ||
97 | mExpiry = expiration + mStartTime; | ||
98 | } | ||
99 | |||
55 | void LLFrameTimer::setExpiryAt(F64 seconds_since_epoch) | 100 | void LLFrameTimer::setExpiryAt(F64 seconds_since_epoch) |
56 | { | 101 | { |
57 | mStartTime = sFrameTime; | 102 | mStartTime = sFrameTime; |