summaryrefslogtreecommitdiff
path: root/indra/llcommon/throttle.cpp
diff options
context:
space:
mode:
authornat-goodspeed <nat@lindenlab.com>2024-09-24 07:28:44 -0400
committerGitHub <noreply@github.com>2024-09-24 07:28:44 -0400
commit1175288a3c685310dbbf7fdd46d7deae0b0bf92d (patch)
tree84fd4d186169807c4da1c0c352d9be92f1e63227 /indra/llcommon/throttle.cpp
parent0ee1106faccf90c883d8b9ffc522a341659742ed (diff)
parent9036e4582cec1893016bd692293ec1c0135f7112 (diff)
Merge pull request #2534 from secondlife/release/luau-scripting
Add Lua scripting to develop, behind feature flag
Diffstat (limited to 'indra/llcommon/throttle.cpp')
-rw-r--r--indra/llcommon/throttle.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/indra/llcommon/throttle.cpp b/indra/llcommon/throttle.cpp
new file mode 100644
index 0000000000..deb0a26fb0
--- /dev/null
+++ b/indra/llcommon/throttle.cpp
@@ -0,0 +1,34 @@
+/**
+ * @file throttle.cpp
+ * @author Nat Goodspeed
+ * @date 2024-08-12
+ * @brief Implementation for ThrottleBase.
+ *
+ * $LicenseInfo:firstyear=2024&license=viewerlgpl$
+ * Copyright (c) 2024, Linden Research, Inc.
+ * $/LicenseInfo$
+ */
+
+// Precompiled header
+#include "linden_common.h"
+// associated header
+#include "throttle.h"
+// STL headers
+// std headers
+// external library headers
+// other Linden headers
+#include "lltimer.h"
+
+bool ThrottleBase::too_fast()
+{
+ F64 now = LLTimer::getElapsedSeconds();
+ if (now < mNext)
+ {
+ return true;
+ }
+ else
+ {
+ mNext = now + mInterval;
+ return false;
+ }
+}