diff options
Diffstat (limited to 'Kernel/Syscalls')
-rw-r--r-- | Kernel/Syscalls/alarm.cpp | 3 | ||||
-rw-r--r-- | Kernel/Syscalls/clock.cpp | 12 |
2 files changed, 7 insertions, 8 deletions
diff --git a/Kernel/Syscalls/alarm.cpp b/Kernel/Syscalls/alarm.cpp index ff3de1350c..18104863ed 100644 --- a/Kernel/Syscalls/alarm.cpp +++ b/Kernel/Syscalls/alarm.cpp @@ -45,8 +45,7 @@ KResultOr<unsigned> Process::sys$alarm(unsigned seconds) } if (seconds > 0) { - // FIXME: Should use AK::Time internally - auto deadline = Time::from_timespec(TimeManagement::the().current_time(CLOCK_REALTIME_COARSE).value()); + auto deadline = TimeManagement::the().current_time(CLOCK_REALTIME_COARSE).value(); deadline = deadline + Time::from_seconds(seconds); m_alarm_timer = TimerQueue::the().add_timer_without_id(CLOCK_REALTIME_COARSE, deadline, [this]() { [[maybe_unused]] auto rc = send_signal(SIGALRM, nullptr); diff --git a/Kernel/Syscalls/clock.cpp b/Kernel/Syscalls/clock.cpp index d883e6ac04..5296644141 100644 --- a/Kernel/Syscalls/clock.cpp +++ b/Kernel/Syscalls/clock.cpp @@ -34,11 +34,12 @@ KResultOr<int> Process::sys$clock_gettime(clockid_t clock_id, Userspace<timespec { REQUIRE_PROMISE(stdio); - auto ts = TimeManagement::the().current_time(clock_id); - if (ts.is_error()) - return ts.error(); + auto time = TimeManagement::the().current_time(clock_id); + if (time.is_error()) + return time.error(); - if (!copy_to_user(user_ts, &ts.value())) + auto ts = time.value().to_timespec(); + if (!copy_to_user(user_ts, &ts)) return EFAULT; return 0; } @@ -56,8 +57,7 @@ KResultOr<int> Process::sys$clock_settime(clockid_t clock_id, Userspace<const ti switch (clock_id) { case CLOCK_REALTIME: - // FIXME: Should use AK::Time internally - TimeManagement::the().set_epoch_time(ts->to_timespec()); + TimeManagement::the().set_epoch_time(ts.value()); break; default: return EINVAL; |