1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 09:57:36 +00:00

Everywhere: Use MonotonicTime instead of Duration

This is easily identifiable by anyone who uses Duration::now_monotonic,
and any downstream users of that data.
This commit is contained in:
kleines Filmröllchen 2023-03-17 19:50:39 +01:00 committed by Jelle Raaijmakers
parent b2e7b8cdff
commit fc5cab5c21
29 changed files with 79 additions and 80 deletions

View file

@ -229,7 +229,7 @@ bool HexDocumentUndoCommand::merge_with(GUI::Command const& other)
m_old[relative_start + i] = typed_other.m_old[i];
}
m_timestamp = Duration::now_monotonic();
m_timestamp = MonotonicTime::now();
return true;
}

View file

@ -103,9 +103,9 @@ public:
ErrorOr<void> try_add_changed_bytes(ByteBuffer old_values, ByteBuffer new_values);
private:
bool commit_time_expired() const { return Duration::now_monotonic() - m_timestamp >= COMMAND_COMMIT_TIME; }
bool commit_time_expired() const { return MonotonicTime::now() - m_timestamp >= COMMAND_COMMIT_TIME; }
Duration m_timestamp = Duration::now_monotonic();
MonotonicTime m_timestamp = MonotonicTime::now();
WeakPtr<HexDocument> m_document;
size_t m_position;
ByteBuffer m_old;

View file

@ -347,7 +347,7 @@ void MainWidget::save_to_file(String const& filename, NonnullOwnPtr<Core::File>
if (sync_result.is_error()) {
GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Failed to save theme file: {}", sync_result.error()));
} else {
m_last_modified_time = Duration::now_monotonic();
m_last_modified_time = MonotonicTime::now();
set_path(filename.to_deprecated_string());
window()->set_modified(false);
}
@ -643,7 +643,7 @@ ErrorOr<void> MainWidget::load_from_file(String const& filename, NonnullOwnPtr<C
ENUMERATE_PATH_ROLES(__ENUMERATE_PATH_ROLE)
#undef __ENUMERATE_PATH_ROLE
m_last_modified_time = Duration::now_monotonic();
m_last_modified_time = MonotonicTime::now();
window()->set_modified(false);
return {};
}

View file

@ -124,7 +124,7 @@ private:
Optional<DeprecatedString> m_path;
Gfx::Palette m_current_palette;
Duration m_last_modified_time { Duration::now_monotonic() };
MonotonicTime m_last_modified_time { MonotonicTime::now() };
RefPtr<AlignmentModel> m_alignment_model;