summaryrefslogtreecommitdiff
path: root/hammer/events.cpp
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /hammer/events.cpp
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'hammer/events.cpp')
-rw-r--r--hammer/events.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/hammer/events.cpp b/hammer/events.cpp
new file mode 100644
index 0000000..c110eab
--- /dev/null
+++ b/hammer/events.cpp
@@ -0,0 +1,42 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose: event time stamping for hammer
+//
+//===========================================================================//
+
+#include "stdafx.h"
+#include "tier0/platform.h"
+#include "mathlib/mathlib.h"
+#include "hammer.h"
+
+// memdbgon must be the last include file in a .cpp file!!!
+#include <tier0/memdbgon.h>
+
+static int g_EventTimeCounters[100];
+static float g_EventTimes[100];
+
+void SignalUpdate(int ev)
+{
+ g_EventTimes[ev]=Plat_FloatTime();
+ g_EventTimeCounters[ev]++;
+}
+
+int GetUpdateCounter(int ev)
+{
+ return g_EventTimeCounters[ev];
+}
+
+float GetUpdateTime(int ev)
+{
+ return g_EventTimes[ev];
+}
+
+void SignalGlobalUpdate(void)
+{
+ float stamp=Plat_FloatTime();
+ for(int i=0;i<NELEMS(g_EventTimes);i++)
+ {
+ g_EventTimes[i] = stamp;
+ g_EventTimeCounters[i]++;
+ }
+}