From 075d17f8ada47e990fe94606c3d21df409223465 Mon Sep 17 00:00:00 2001 From: Stefan Boberg Date: Tue, 2 May 2023 10:01:47 +0200 Subject: moved source directories into `/src` (#264) * moved source directories into `/src` * updated bundle.lua for new `src` path * moved some docs, icon * removed old test trees --- zencore/timer.cpp | 105 ------------------------------------------------------ 1 file changed, 105 deletions(-) delete mode 100644 zencore/timer.cpp (limited to 'zencore/timer.cpp') diff --git a/zencore/timer.cpp b/zencore/timer.cpp deleted file mode 100644 index 1655e912d..000000000 --- a/zencore/timer.cpp +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright Epic Games, Inc. All Rights Reserved. - -#include -#include - -#include - -#if ZEN_PLATFORM_WINDOWS -# include -#elif ZEN_PLATFORM_LINUX -# include -# include -#endif - -namespace zen { - -uint64_t -GetHifreqTimerValue() -{ - uint64_t Timestamp; - -#if ZEN_PLATFORM_WINDOWS - LARGE_INTEGER li; - QueryPerformanceCounter(&li); - - Timestamp = li.QuadPart; -#else - struct timespec ts; - clock_gettime(CLOCK_MONOTONIC, &ts); - Timestamp = (uint64_t(ts.tv_sec) * 1000000ull) + (uint64_t(ts.tv_nsec) / 1000ull); -#endif - - return Timestamp; -} - -uint64_t -InternalGetHifreqTimerFrequency() -{ -#if ZEN_PLATFORM_WINDOWS - LARGE_INTEGER li; - QueryPerformanceFrequency(&li); - - return li.QuadPart; -#else - return 1000000ull; -#endif -} - -uint64_t QpcFreq = InternalGetHifreqTimerFrequency(); -static const double QpcFactor = 1.0 / InternalGetHifreqTimerFrequency(); - -uint64_t -GetHifreqTimerFrequency() -{ - return QpcFreq; -} - -double -GetHifreqTimerToSeconds() -{ - return QpcFactor; -} - -uint64_t -GetHifreqTimerFrequencySafe() -{ - if (!QpcFreq) - { - QpcFreq = InternalGetHifreqTimerFrequency(); - } - - return QpcFreq; -} - -////////////////////////////////////////////////////////////////////////// - -uint64_t detail::g_LofreqTimerValue = GetHifreqTimerValue(); - -void -UpdateLofreqTimerValue() -{ - detail::g_LofreqTimerValue = GetHifreqTimerValue(); -} - -uint64_t -GetLofreqTimerFrequency() -{ - return GetHifreqTimerFrequencySafe(); -} - -////////////////////////////////////////////////////////////////////////// -// -// Testing related code follows... -// - -#if ZEN_WITH_TESTS - -void -timer_forcelink() -{ -} - -#endif - -} // namespace zen -- cgit v1.2.3