diff --git a/include/MUtils/OSSupport.h b/include/MUtils/OSSupport.h index fd66c1f..b21d3c1 100644 --- a/include/MUtils/OSSupport.h +++ b/include/MUtils/OSSupport.h @@ -152,6 +152,10 @@ namespace MUtils //Process ID MUTILS_API quint32 process_id(const QProcess *proc); + //System timer resolution + MUTILS_API bool setup_timer_resolution(const quint32 &interval = 1); + MUTILS_API bool reset_timer_resolution(const quint32 &interval = 1); + //Check if debugger is present MUTILS_API void check_debugger(void); diff --git a/src/OSSupport_Win32.cpp b/src/OSSupport_Win32.cpp index 33d3934..3df1dba 100644 --- a/src/OSSupport_Win32.cpp +++ b/src/OSSupport_Win32.cpp @@ -29,6 +29,7 @@ #include #include #include +#include //Internal #include @@ -933,6 +934,20 @@ quint32 MUtils::OS::process_id(const QProcess *proc) return (procInf) ? procInf->dwProcessId : NULL; } +/////////////////////////////////////////////////////////////////////////////// +// SYSTEM TIMER +/////////////////////////////////////////////////////////////////////////////// + +bool MUtils::OS::setup_timer_resolution(const quint32 &interval) +{ + return timeBeginPeriod(interval) == TIMERR_NOERROR; +} + +bool MUtils::OS::reset_timer_resolution(const quint32 &interval) +{ + return timeEndPeriod(interval) == TIMERR_NOERROR; +} + /////////////////////////////////////////////////////////////////////////////// // DEBUGGER CHECK ///////////////////////////////////////////////////////////////////////////////