diff options
author | sfan5 <sfan5@live.de> | 2022-01-22 20:20:43 +0100 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2022-01-27 22:30:02 +0100 |
commit | 7aea5cb88f9a8cc9f9ca52ecd4d13cfd7ab16e69 (patch) | |
tree | b67422b1edbed988370e0e7bdc5964d9447aaf68 /src/porting.cpp | |
parent | 058846d687bef214fe6216938d4cf8bf2c79290e (diff) | |
download | minetest-7aea5cb88f9a8cc9f9ca52ecd4d13cfd7ab16e69.tar.gz minetest-7aea5cb88f9a8cc9f9ca52ecd4d13cfd7ab16e69.tar.bz2 minetest-7aea5cb88f9a8cc9f9ca52ecd4d13cfd7ab16e69.zip |
Enable high-res timers on Windows
This should fix issues like #11891, caused by the fps limiting
code being unable to operate correctly.
Diffstat (limited to 'src/porting.cpp')
-rw-r--r-- | src/porting.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/porting.cpp b/src/porting.cpp index 4c87bddee..f78de39ad 100644 --- a/src/porting.cpp +++ b/src/porting.cpp @@ -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; |