From 195d6cded05f7ef5bde695ee047b341a0265eab3 Mon Sep 17 00:00:00 2001 From: Piotr Dziwinski Date: Sun, 24 Mar 2013 00:03:37 +0100 Subject: Fixed timer functions on win32 * changed win32 implementation to QueryPerformaceTimer system function * refactored system utils code * proper tests for time utils and update event creation in application * should fix issue #134 --- src/app/system_windows.h | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'src/app/system_windows.h') diff --git a/src/app/system_windows.h b/src/app/system_windows.h index 804d064..e367b92 100644 --- a/src/app/system_windows.h +++ b/src/app/system_windows.h @@ -22,23 +22,32 @@ #include "app/system.h" -#include - struct SystemTimeStamp { - FILETIME fileTime; + long long counterValue; SystemTimeStamp() { - fileTime.dwHighDateTime = fileTime.dwLowDateTime = 0; + counterValue = 0; } }; -std::string UTF8_Encode_Windows(const std::wstring &wstr); -std::wstring UTF8_Decode_Windows(const std::string &str); -SystemDialogResult SystemDialog_Windows(SystemDialogType type, const std::string& title, const std::string& message); +class CSystemUtilsWindows : public CSystemUtils +{ +public: + virtual void Init() override; + + virtual SystemDialogResult SystemDialog(SystemDialogType type, const std::string& title, const std::string& message) override; -void GetCurrentTimeStamp_Windows(SystemTimeStamp *stamp); -long long GetTimeStampExactResolution_Windows(); -long long TimeStampExactDiff_Windows(SystemTimeStamp *before, SystemTimeStamp *after); + virtual void GetCurrentTimeStamp(SystemTimeStamp *stamp) override; + virtual long long GetTimeStampExactResolution() override; + virtual long long TimeStampExactDiff(SystemTimeStamp *before, SystemTimeStamp *after) override; + +private: + std::string UTF8_Encode(const std::wstring &wstr); + std::wstring UTF8_Decode(const std::string &str); + +protected: + long long m_counterFrequency; +}; -- cgit v1.2.3-1-g7c22