1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:07:35 +00:00

Userland: Remove remaining users of Duration::now_realtime()

This is a clear sign that they want to use a UnixDateTime instead.

This also adds support for placing durations and date times into SQL
databases via their millisecond offset to UTC.
This commit is contained in:
kleines Filmröllchen 2023-03-13 22:35:22 +01:00 committed by Jelle Raaijmakers
parent 82c681e44b
commit effcd080ca
16 changed files with 62 additions and 45 deletions

View file

@ -355,7 +355,7 @@ public:
break;
m_level = i;
}
auto const now { Duration::now_realtime() };
auto const now { UnixDateTime::now() };
auto const delay = s_level_map[m_level].m_delay;
if (now - m_last_update > delay) {
m_last_update = now;
@ -372,7 +372,7 @@ public:
m_block.random_shape();
m_next_block.random_shape();
update_shadow_hint_block();
m_last_update = Duration::now_realtime();
m_last_update = UnixDateTime::now();
m_state = GameState::Active;
}
@ -384,7 +384,8 @@ private:
unsigned m_level {};
unsigned m_score {};
GameState m_state { GameState::GameOver };
Duration m_last_update {};
// FIXME: Should probably use a monotonic clock instead.
UnixDateTime m_last_update {};
struct LevelMap final {
unsigned const m_score;