From e40a661bca7ff795c7f91e3309530a28139ae76b Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Wed, 3 Apr 2024 02:06:10 +0200 Subject: [PATCH] Tier0: move GetUnixTimeStamp() to utility code --- src/game/server/liveapi/liveapi.cpp | 8 -------- src/public/tier0/utility.h | 1 + src/tier0/utility.cpp | 10 ++++++++++ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/game/server/liveapi/liveapi.cpp b/src/game/server/liveapi/liveapi.cpp index 7ad96c52..7333fe72 100644 --- a/src/game/server/liveapi/liveapi.cpp +++ b/src/game/server/liveapi/liveapi.cpp @@ -332,14 +332,6 @@ static bool LiveAPI_CheckSwitchType(HSQUIRRELVM const v, const SQObjectPtr& obj) #define LIVEAPI_UNSUPPORTED_TYPE_ERROR(v, gotType, eventMsg) {v_SQVM_RaiseError(v, "Value type \"%s\" is not supported for message \"%s\".\n", IdType2Name(gotType), eventMsg->GetTypeName().c_str()); return false; } #define LIVEAPI_CHECK_RECURSION_DEPTH(v, currDepth) { if (currDepth > LIVEAPI_MAX_ITEM_DEPTH) { v_SQVM_RaiseError(v, "Exceeded nesting depth limit of \"%i\".", LIVEAPI_MAX_ITEM_DEPTH); return false; }} -uint64_t GetUnixTimeStamp() // TODO: move elsewhere -{ - __time64_t time; - _time64(&time); - - return time; -} - /* ██╗███╗ ██╗████████╗███████╗██████╗ ███╗ ███╗███████╗██████╗ ██╗ █████╗ ██████╗ ██╗ ██╗ diff --git a/src/public/tier0/utility.h b/src/public/tier0/utility.h index cf8e2e1a..f245e34e 100644 --- a/src/public/tier0/utility.h +++ b/src/public/tier0/utility.h @@ -122,6 +122,7 @@ int CompareIPv6(const IN6_ADDR& ipA, const IN6_ADDR& ipB); ///////////////////////////////////////////////////////////////////////////// // Time +uint64_t GetUnixTimeStamp(); std::chrono::nanoseconds IntervalToDuration(const float flInterval); ///////////////////////////////////////////////////////////////////////////// diff --git a/src/tier0/utility.cpp b/src/tier0/utility.cpp index f3105773..0c55dfd1 100644 --- a/src/tier0/utility.cpp +++ b/src/tier0/utility.cpp @@ -1148,6 +1148,16 @@ int CompareIPv6(const IN6_ADDR& ipA, const IN6_ADDR& ipB) return 0; } +/////////////////////////////////////////////////////////////////////////////// +// For obtaining the current timestamp. +uint64_t GetUnixTimeStamp() +{ + __time64_t time; + _time64(&time); + + return time; +} + /////////////////////////////////////////////////////////////////////////////// // For obtaining a duration from a certain interval. std::chrono::nanoseconds IntervalToDuration(const float flInterval)