summaryrefslogtreecommitdiff
path: root/Kernel/Devices
diff options
context:
space:
mode:
authorkleines Filmröllchen <filmroellchen@serenityos.org>2023-03-17 19:50:39 +0100
committerJelle Raaijmakers <jelle@gmta.nl>2023-05-24 23:18:07 +0200
commitfc5cab5c2180b4ba8efcf74b937c2b7e26dad781 (patch)
tree59cdd3836d2db037551e7e970d7b64e970814404 /Kernel/Devices
parentb2e7b8cdffa2297b335698677f5c0434dbf92e75 (diff)
downloadserenity-fc5cab5c2180b4ba8efcf74b937c2b7e26dad781.zip
Everywhere: Use MonotonicTime instead of Duration
This is easily identifiable by anyone who uses Duration::now_monotonic, and any downstream users of that data.
Diffstat (limited to 'Kernel/Devices')
-rw-r--r--Kernel/Devices/Audio/IntelHDA/Controller.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/Kernel/Devices/Audio/IntelHDA/Controller.cpp b/Kernel/Devices/Audio/IntelHDA/Controller.cpp
index cae6b6800b..74c8498f5a 100644
--- a/Kernel/Devices/Audio/IntelHDA/Controller.cpp
+++ b/Kernel/Devices/Audio/IntelHDA/Controller.cpp
@@ -328,12 +328,12 @@ ErrorOr<u32> Controller::get_pcm_output_sample_rate(size_t channel_index)
ErrorOr<void> wait_until(size_t delay_in_microseconds, size_t timeout_in_microseconds, Function<ErrorOr<bool>()> condition)
{
+ auto const timeout = Duration::from_microseconds(static_cast<i64>(timeout_in_microseconds));
auto const& time_management = TimeManagement::the();
- // FIXME: Use monotonic time instead.
- u64 start_microseconds = time_management.now().offset_to_epoch().to_microseconds();
+ auto start = time_management.monotonic_time(TimePrecision::Precise);
while (!TRY(condition())) {
microseconds_delay(delay_in_microseconds);
- if ((time_management.now().offset_to_epoch().to_microseconds() - start_microseconds) >= timeout_in_microseconds)
+ if (time_management.monotonic_time(TimePrecision::Precise) - start >= timeout)
return ETIMEDOUT;
}
return {};