summaryrefslogtreecommitdiff
path: root/indra/llcommon/throttle.cpp
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2024-08-15 09:56:45 -0400
committerNat Goodspeed <nat@lindenlab.com>2024-08-15 09:56:45 -0400
commite8388d1d9b3055a68a97551f2718380fcaee320b (patch)
tree2b28407f4847327c72c587ff4d8b1f1560126804 /indra/llcommon/throttle.cpp
parentb3fb23ee0c6d33f5eba3502328ffb0011b5f25fb (diff)
parent8324ef8edf68c074f4d30322d37b091b3ea10539 (diff)
Merge branch 'release/luau-scripting' into viewer-lua-2237
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..d5f7d5dcab
--- /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;
+ }
+}