summaryrefslogtreecommitdiff
path: root/Userland/Applications
diff options
context:
space:
mode:
authorkleines Filmröllchen <filmroellchen@serenityos.org>2023-03-13 16:30:34 +0100
committerJelle Raaijmakers <jelle@gmta.nl>2023-05-24 23:18:07 +0200
commit213025f210a785ca71b7659d7dc4f5dc3c030622 (patch)
treec255161bbb780822d4d5a21c3157303f905b781b /Userland/Applications
parent82ddc813d52b8314f63c583a90953ae5ac607ffd (diff)
downloadserenity-213025f210a785ca71b7659d7dc4f5dc3c030622.zip
AK: Rename Time to Duration
That's what this class really is; in fact that's what the first line of the comment says it is. This commit does not rename the main files, since those will contain other time-related classes in a little bit.
Diffstat (limited to 'Userland/Applications')
-rw-r--r--Userland/Applications/3DFileViewer/main.cpp2
-rw-r--r--Userland/Applications/Browser/CookieJar.cpp10
-rw-r--r--Userland/Applications/Browser/StorageWidget.cpp2
-rw-r--r--Userland/Applications/ClockSettings/TimeZoneSettingsWidget.cpp2
-rw-r--r--Userland/Applications/HexEditor/HexDocument.cpp2
-rw-r--r--Userland/Applications/HexEditor/HexDocument.h6
-rw-r--r--Userland/Applications/Piano/AudioPlayerLoop.cpp2
-rw-r--r--Userland/Applications/ThemeEditor/MainWidget.cpp4
-rw-r--r--Userland/Applications/ThemeEditor/MainWidget.h2
-rw-r--r--Userland/Applications/VideoPlayer/VideoPlayerWidget.cpp8
-rw-r--r--Userland/Applications/VideoPlayer/VideoPlayerWidget.h4
11 files changed, 22 insertions, 22 deletions
diff --git a/Userland/Applications/3DFileViewer/main.cpp b/Userland/Applications/3DFileViewer/main.cpp
index f1b32c7ea6..f2d5f3ea9f 100644
--- a/Userland/Applications/3DFileViewer/main.cpp
+++ b/Userland/Applications/3DFileViewer/main.cpp
@@ -115,7 +115,7 @@ private:
float m_rotation_speed = 60.f;
bool m_show_frame_rate = false;
int m_cycles = 0;
- Time m_accumulated_time = {};
+ Duration m_accumulated_time = {};
RefPtr<GUI::Label> m_stats;
GLint m_wrap_s_mode = GL_REPEAT;
GLint m_wrap_t_mode = GL_REPEAT;
diff --git a/Userland/Applications/Browser/CookieJar.cpp b/Userland/Applications/Browser/CookieJar.cpp
index 38dd10047d..4b1abf25f1 100644
--- a/Userland/Applications/Browser/CookieJar.cpp
+++ b/Userland/Applications/Browser/CookieJar.cpp
@@ -286,7 +286,7 @@ void CookieJar::store_cookie(Web::Cookie::ParsedCookie const& parsed_cookie, con
// 2. Create a new cookie with name cookie-name, value cookie-value. Set the creation-time and the last-access-time to the current date and time.
Web::Cookie::Cookie cookie { parsed_cookie.name, parsed_cookie.value, parsed_cookie.same_site_attribute };
- cookie.creation_time = Time::now_realtime();
+ cookie.creation_time = Duration::now_realtime();
cookie.last_access_time = cookie.creation_time;
if (parsed_cookie.expiry_time_from_max_age_attribute.has_value()) {
@@ -302,7 +302,7 @@ void CookieJar::store_cookie(Web::Cookie::ParsedCookie const& parsed_cookie, con
} else {
// Set the cookie's persistent-flag to false. Set the cookie's expiry-time to the latest representable date.
cookie.persistent = false;
- cookie.expiry_time = Time::max();
+ cookie.expiry_time = Duration::max();
}
// 4. If the cookie-attribute-list contains an attribute with an attribute-name of "Domain":
@@ -421,7 +421,7 @@ Vector<Web::Cookie::Cookie> CookieJar::get_matching_cookies(const URL& url, Depr
});
// 3. Update the last-access-time of each cookie in the cookie-list to the current date and time.
- auto now = Time::now_realtime();
+ auto now = Duration::now_realtime();
for (auto& cookie : cookie_list) {
cookie.last_access_time = now;
@@ -462,7 +462,7 @@ static ErrorOr<Web::Cookie::Cookie> parse_cookie(ReadonlySpan<SQL::Value> row)
return Error::from_string_view(name);
auto time = value.to_int<i64>().value();
- field = Time::from_seconds(time);
+ field = Duration::from_seconds(time);
return {};
};
@@ -624,7 +624,7 @@ void CookieJar::select_all_cookies_from_database(OnSelectAllCookiesResult on_res
void CookieJar::purge_expired_cookies()
{
- auto now = Time::now_realtime().to_seconds();
+ auto now = Duration::now_realtime().to_seconds();
m_storage.visit(
[&](PersistedStorage& storage) {
diff --git a/Userland/Applications/Browser/StorageWidget.cpp b/Userland/Applications/Browser/StorageWidget.cpp
index 9837b879cd..9a9b20124a 100644
--- a/Userland/Applications/Browser/StorageWidget.cpp
+++ b/Userland/Applications/Browser/StorageWidget.cpp
@@ -130,7 +130,7 @@ void StorageWidget::clear_session_storage_entries()
void StorageWidget::delete_cookie(Web::Cookie::Cookie cookie)
{
// Delete cookie by making its expiry time in the past.
- cookie.expiry_time = Time::from_seconds(0);
+ cookie.expiry_time = Duration::from_seconds(0);
if (on_update_cookie)
on_update_cookie(move(cookie));
}
diff --git a/Userland/Applications/ClockSettings/TimeZoneSettingsWidget.cpp b/Userland/Applications/ClockSettings/TimeZoneSettingsWidget.cpp
index a4bee4981d..f3849a4edc 100644
--- a/Userland/Applications/ClockSettings/TimeZoneSettingsWidget.cpp
+++ b/Userland/Applications/ClockSettings/TimeZoneSettingsWidget.cpp
@@ -133,7 +133,7 @@ void TimeZoneSettingsWidget::set_time_zone_location()
m_time_zone_location = compute_time_zone_location();
auto locale = Locale::default_locale();
- auto now = AK::Time::now_realtime();
+ auto now = AK::Duration::now_realtime();
auto name = Locale::format_time_zone(locale, m_time_zone, Locale::CalendarPatternStyle::Long, now).release_value_but_fixme_should_propagate_errors();
auto offset = Locale::format_time_zone(locale, m_time_zone, Locale::CalendarPatternStyle::LongOffset, now).release_value_but_fixme_should_propagate_errors();
diff --git a/Userland/Applications/HexEditor/HexDocument.cpp b/Userland/Applications/HexEditor/HexDocument.cpp
index a350fd284a..b8b5f7ce43 100644
--- a/Userland/Applications/HexEditor/HexDocument.cpp
+++ b/Userland/Applications/HexEditor/HexDocument.cpp
@@ -229,7 +229,7 @@ bool HexDocumentUndoCommand::merge_with(GUI::Command const& other)
m_old[relative_start + i] = typed_other.m_old[i];
}
- m_timestamp = Time::now_monotonic();
+ m_timestamp = Duration::now_monotonic();
return true;
}
diff --git a/Userland/Applications/HexEditor/HexDocument.h b/Userland/Applications/HexEditor/HexDocument.h
index 256f753f65..c28a9aa885 100644
--- a/Userland/Applications/HexEditor/HexDocument.h
+++ b/Userland/Applications/HexEditor/HexDocument.h
@@ -15,7 +15,7 @@
#include <LibCore/Forward.h>
#include <LibGUI/Command.h>
-constexpr Time COMMAND_COMMIT_TIME = Time::from_milliseconds(400);
+constexpr Duration COMMAND_COMMIT_TIME = Duration::from_milliseconds(400);
class HexDocument : public Weakable<HexDocument> {
public:
@@ -103,9 +103,9 @@ public:
ErrorOr<void> try_add_changed_bytes(ByteBuffer old_values, ByteBuffer new_values);
private:
- bool commit_time_expired() const { return Time::now_monotonic() - m_timestamp >= COMMAND_COMMIT_TIME; }
+ bool commit_time_expired() const { return Duration::now_monotonic() - m_timestamp >= COMMAND_COMMIT_TIME; }
- Time m_timestamp = Time::now_monotonic();
+ Duration m_timestamp = Duration::now_monotonic();
WeakPtr<HexDocument> m_document;
size_t m_position;
ByteBuffer m_old;
diff --git a/Userland/Applications/Piano/AudioPlayerLoop.cpp b/Userland/Applications/Piano/AudioPlayerLoop.cpp
index 82dd16edef..9117605ff9 100644
--- a/Userland/Applications/Piano/AudioPlayerLoop.cpp
+++ b/Userland/Applications/Piano/AudioPlayerLoop.cpp
@@ -112,7 +112,7 @@ ErrorOr<void> AudioPlayerLoop::send_audio_to_server()
auto sample_rate = static_cast<double>(m_resampler->target());
auto buffer_play_time_ns = 1'000'000'000.0 / (sample_rate / static_cast<double>(Audio::AUDIO_BUFFER_SIZE));
- auto good_sleep_time = Time::from_nanoseconds(static_cast<unsigned>(buffer_play_time_ns)).to_timespec();
+ auto good_sleep_time = Duration::from_nanoseconds(static_cast<unsigned>(buffer_play_time_ns)).to_timespec();
size_t start_of_chunk_to_write = 0;
while (start_of_chunk_to_write + Audio::AUDIO_BUFFER_SIZE <= m_remaining_samples.size()) {
diff --git a/Userland/Applications/ThemeEditor/MainWidget.cpp b/Userland/Applications/ThemeEditor/MainWidget.cpp
index 889761dbdc..f579b948b2 100644
--- a/Userland/Applications/ThemeEditor/MainWidget.cpp
+++ b/Userland/Applications/ThemeEditor/MainWidget.cpp
@@ -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 = Time::now_monotonic();
+ m_last_modified_time = Duration::now_monotonic();
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 = Time::now_monotonic();
+ m_last_modified_time = Duration::now_monotonic();
window()->set_modified(false);
return {};
}
diff --git a/Userland/Applications/ThemeEditor/MainWidget.h b/Userland/Applications/ThemeEditor/MainWidget.h
index 269a9c6779..98cb9cc41d 100644
--- a/Userland/Applications/ThemeEditor/MainWidget.h
+++ b/Userland/Applications/ThemeEditor/MainWidget.h
@@ -124,7 +124,7 @@ private:
Optional<DeprecatedString> m_path;
Gfx::Palette m_current_palette;
- Time m_last_modified_time { Time::now_monotonic() };
+ Duration m_last_modified_time { Duration::now_monotonic() };
RefPtr<AlignmentModel> m_alignment_model;
diff --git a/Userland/Applications/VideoPlayer/VideoPlayerWidget.cpp b/Userland/Applications/VideoPlayer/VideoPlayerWidget.cpp
index 32cdd0c0a7..69960606d4 100644
--- a/Userland/Applications/VideoPlayer/VideoPlayerWidget.cpp
+++ b/Userland/Applications/VideoPlayer/VideoPlayerWidget.cpp
@@ -59,7 +59,7 @@ ErrorOr<void> VideoPlayerWidget::setup_interface()
update_seek_slider_max();
auto progress = value / static_cast<double>(m_seek_slider->max());
auto duration = m_playback_manager->duration().to_milliseconds();
- Time timestamp = Time::from_milliseconds(static_cast<i64>(round(progress * static_cast<double>(duration))));
+ Duration timestamp = Duration::from_milliseconds(static_cast<i64>(round(progress * static_cast<double>(duration))));
auto seek_mode_to_use = m_seek_slider->knob_dragging() ? seek_mode() : Video::PlaybackManager::SeekMode::Accurate;
m_playback_manager->seek_to_timestamp(timestamp, seek_mode_to_use);
set_current_timestamp(m_playback_manager->current_playback_time());
@@ -252,7 +252,7 @@ void VideoPlayerWidget::update_seek_slider_max()
m_seek_slider->set_enabled(true);
}
-void VideoPlayerWidget::set_current_timestamp(Time timestamp)
+void VideoPlayerWidget::set_current_timestamp(Duration timestamp)
{
set_time_label(timestamp);
if (!m_playback_manager)
@@ -261,10 +261,10 @@ void VideoPlayerWidget::set_current_timestamp(Time timestamp)
m_seek_slider->set_value(static_cast<int>(round(progress * m_seek_slider->max())), GUI::AllowCallback::No);
}
-void VideoPlayerWidget::set_time_label(Time timestamp)
+void VideoPlayerWidget::set_time_label(Duration timestamp)
{
StringBuilder string_builder;
- auto append_time = [&](Time time) {
+ auto append_time = [&](Duration time) {
auto seconds = (time.to_milliseconds() + 500) / 1000;
string_builder.append(human_readable_digital_time(seconds));
};
diff --git a/Userland/Applications/VideoPlayer/VideoPlayerWidget.h b/Userland/Applications/VideoPlayer/VideoPlayerWidget.h
index 93385bc2c2..745577b045 100644
--- a/Userland/Applications/VideoPlayer/VideoPlayerWidget.h
+++ b/Userland/Applications/VideoPlayer/VideoPlayerWidget.h
@@ -45,8 +45,8 @@ private:
ErrorOr<void> setup_interface();
void update_play_pause_icon();
void update_seek_slider_max();
- void set_current_timestamp(Time);
- void set_time_label(Time);
+ void set_current_timestamp(Duration);
+ void set_time_label(Duration);
void on_decoding_error(Video::DecoderError const&);
void cycle_sizing_modes();