TickCounter.cpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. // Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
  2. // SPDX-FileCopyrightText: 2021 Jorrit Rouwe
  3. // SPDX-License-Identifier: MIT
  4. #include <Jolt/Jolt.h>
  5. #include <Jolt/Core/TickCounter.h>
  6. #if defined(JPH_PLATFORM_WINDOWS)
  7. JPH_SUPPRESS_WARNING_PUSH
  8. JPH_MSVC_SUPPRESS_WARNING(5039) // winbase.h(13179): warning C5039: 'TpSetCallbackCleanupGroup': pointer or reference to potentially throwing function passed to 'extern "C"' function under -EHc. Undefined behavior may occur if this function throws an exception.
  9. JPH_MSVC2026_PLUS_SUPPRESS_WARNING(4865) // wingdi.h(2806,1): '<unnamed-enum-DISPLAYCONFIG_OUTPUT_TECHNOLOGY_OTHER>': the underlying type will change from 'int' to '__int64' when '/Zc:enumTypes' is specified on the command line
  10. #ifndef WIN32_LEAN_AND_MEAN
  11. #define WIN32_LEAN_AND_MEAN
  12. #endif
  13. #ifndef JPH_COMPILER_MINGW
  14. #include <Windows.h>
  15. #else
  16. #include <windows.h>
  17. #endif
  18. JPH_SUPPRESS_WARNING_POP
  19. #endif
  20. JPH_NAMESPACE_BEGIN
  21. #if defined(JPH_PLATFORM_WINDOWS_UWP) || (defined(JPH_PLATFORM_WINDOWS) && defined(JPH_CPU_ARM))
  22. uint64 GetProcessorTickCount()
  23. {
  24. LARGE_INTEGER count;
  25. QueryPerformanceCounter(&count);
  26. return uint64(count.QuadPart);
  27. }
  28. #endif // JPH_PLATFORM_WINDOWS_UWP || (JPH_PLATFORM_WINDOWS && JPH_CPU_ARM)
  29. JPH_NAMESPACE_END