diff options
author | Patric Stout <truebrain@openttd.org> | 2021-02-17 14:46:19 +0100 |
---|---|---|
committer | Patric Stout <github@truebrain.nl> | 2021-02-19 10:43:15 +0100 |
commit | 25f6851ca184346297c1d953e9e649311a0dc083 (patch) | |
tree | 5fa298bd14e8c92eefa69d05ec69cf37f90fbd59 /src/video/sdl2_v.h | |
parent | d437445c67bb76713614ae5a4242168c891b9978 (diff) | |
download | openttd-25f6851ca184346297c1d953e9e649311a0dc083.tar.xz |
Codechange: switch all video drivers to std::chrono for keeping time
On all OSes we tested the std::chrono::steady_clock is of a high
enough resolution to do millisecond measurements, which is all we
need.
By accident, this fixes a Win32 driver bug, where we would never
hit our targets, as the resolution of the clock was too low to
do accurate millisecond measurements with (it was ~16ms resolution
instead).
Diffstat (limited to 'src/video/sdl2_v.h')
-rw-r--r-- | src/video/sdl2_v.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/video/sdl2_v.h b/src/video/sdl2_v.h index d1c4d957c..61d607d56 100644 --- a/src/video/sdl2_v.h +++ b/src/video/sdl2_v.h @@ -62,9 +62,9 @@ private: */ bool edit_box_focused; - uint32 cur_ticks; - uint32 last_cur_ticks; - uint32 next_tick; + std::chrono::steady_clock::time_point cur_ticks; + std::chrono::steady_clock::time_point last_cur_ticks; + std::chrono::steady_clock::time_point next_tick; int startup_display; std::thread draw_thread; |