diff options
| author | Stefan Boberg <[email protected]> | 2021-10-04 12:15:21 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2021-10-04 12:15:21 +0200 |
| commit | dc9028c93991011b6d7621aa4a70af1ecf8e2066 (patch) | |
| tree | 6115805d809a7e0f61816a9af3d6bf63f29be031 /zencore | |
| parent | Added build version tag using the latest Git commit hash. (#16) (diff) | |
| download | zen-dc9028c93991011b6d7621aa4a70af1ecf8e2066.tar.xz zen-dc9028c93991011b6d7621aa4a70af1ecf8e2066.zip | |
timer: Added GetLofreqTimerValue() etc for applications that don't need particularly high resolution
This value is intended to get updated as part of some higher level tick process. It is not automatic.
Diffstat (limited to 'zencore')
| -rw-r--r-- | zencore/include/zencore/timer.h | 15 | ||||
| -rw-r--r-- | zencore/timer.cpp | 16 |
2 files changed, 31 insertions, 0 deletions
diff --git a/zencore/include/zencore/timer.h b/zencore/include/zencore/timer.h index 693b6daaa..e4ddc3505 100644 --- a/zencore/include/zencore/timer.h +++ b/zencore/include/zencore/timer.h @@ -38,6 +38,21 @@ private: uint64_t m_StartValue; }; +// Low frequency timers + +namespace detail { + extern ZENCORE_API uint64_t g_LofreqTimerValue; +} // namespace detail + +inline uint64_t +GetLofreqTimerValue() +{ + return detail::g_LofreqTimerValue; +} + +ZENCORE_API void UpdateLofreqTimerValue(); +ZENCORE_API uint64_t GetLofreqTimerFrequency(); + void timer_forcelink(); // internal } // namespace zen diff --git a/zencore/timer.cpp b/zencore/timer.cpp index 5d30d9b29..9180519bd 100644 --- a/zencore/timer.cpp +++ b/zencore/timer.cpp @@ -69,6 +69,22 @@ GetHifreqTimerFrequencySafe() } ////////////////////////////////////////////////////////////////////////// + +uint64_t detail::g_LofreqTimerValue = GetHifreqTimerValue(); + +void +UpdateLofreqTimerValue() +{ + detail::g_LofreqTimerValue = GetHifreqTimerValue(); +} + +uint64_t +GetLofreqTimerFrequency() +{ + return GetHifreqTimerFrequencySafe(); +} + +////////////////////////////////////////////////////////////////////////// // // Testing related code follows... // |