mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Enable high-res timers on Windows
This should fix issues like #11891, caused by the fps limiting code being unable to operate correctly.
This commit is contained in:
parent
058846d687
commit
7aea5cb88f
2 changed files with 5 additions and 1 deletions
|
@ -35,6 +35,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
#include <algorithm>
|
||||
#include <shlwapi.h>
|
||||
#include <shellapi.h>
|
||||
#include <mmsystem.h>
|
||||
#endif
|
||||
#if !defined(_WIN32)
|
||||
#include <unistd.h>
|
||||
|
@ -766,6 +767,9 @@ bool open_directory(const std::string &path)
|
|||
|
||||
inline double get_perf_freq()
|
||||
{
|
||||
// Also use this opportunity to enable high-res timers
|
||||
timeBeginPeriod(1);
|
||||
|
||||
LARGE_INTEGER freq;
|
||||
QueryPerformanceFrequency(&freq);
|
||||
return freq.QuadPart;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue