mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 08:07:34 +00:00
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.
This commit is contained in:
parent
82ddc813d5
commit
213025f210
140 changed files with 634 additions and 628 deletions
|
@ -20,7 +20,7 @@ ErrorOr<FlatPtr> Process::sys$alarm(unsigned seconds)
|
|||
bool was_in_use = false;
|
||||
if (TimerQueue::the().cancel_timer(*timer, &was_in_use)) {
|
||||
// The timer hasn't fired. Round up the remaining time (if any)
|
||||
Time remaining = timer->remaining() + Time::from_nanoseconds(999'999'999);
|
||||
Duration remaining = timer->remaining() + Duration::from_nanoseconds(999'999'999);
|
||||
previous_alarm_remaining = remaining.to_truncated_seconds();
|
||||
}
|
||||
// We had an existing alarm, must return a non-zero value here!
|
||||
|
@ -30,7 +30,7 @@ ErrorOr<FlatPtr> Process::sys$alarm(unsigned seconds)
|
|||
|
||||
if (seconds > 0) {
|
||||
auto deadline = TimeManagement::the().current_time(CLOCK_REALTIME_COARSE);
|
||||
deadline = deadline + Time::from_seconds(seconds);
|
||||
deadline = deadline + Duration::from_seconds(seconds);
|
||||
if (!timer) {
|
||||
timer = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) Timer));
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ ErrorOr<FlatPtr> Process::sys$beep(int tone)
|
|||
return EINVAL;
|
||||
#if ARCH(X86_64)
|
||||
PCSpeaker::tone_on(tone);
|
||||
auto result = Thread::current()->sleep(Time::from_nanoseconds(200'000'000));
|
||||
auto result = Thread::current()->sleep(Duration::from_nanoseconds(200'000'000));
|
||||
PCSpeaker::tone_off();
|
||||
if (result.was_interrupted())
|
||||
return EINTR;
|
||||
|
|
|
@ -82,7 +82,7 @@ ErrorOr<FlatPtr> Process::sys$clock_nanosleep(Userspace<Syscall::SC_clock_nanosl
|
|||
if (is_absolute) {
|
||||
was_interrupted = Thread::current()->sleep_until(params.clock_id, requested_sleep).was_interrupted();
|
||||
} else {
|
||||
Time remaining_sleep;
|
||||
Duration remaining_sleep;
|
||||
was_interrupted = Thread::current()->sleep(params.clock_id, requested_sleep, &remaining_sleep).was_interrupted();
|
||||
timespec remaining_sleep_ts = remaining_sleep.to_timespec();
|
||||
if (was_interrupted && params.remaining_sleep) {
|
||||
|
@ -123,7 +123,7 @@ ErrorOr<FlatPtr> Process::sys$adjtime(Userspace<timeval const*> user_delta, User
|
|||
return EPERM;
|
||||
auto delta = TRY(copy_time_from_user(user_delta));
|
||||
|
||||
// FIXME: Should use AK::Time internally
|
||||
// FIXME: Should use AK::Duration internally
|
||||
TimeManagement::the().set_remaining_epoch_time_adjustment(delta.to_timespec());
|
||||
}
|
||||
|
||||
|
|
|
@ -19,12 +19,12 @@ ErrorOr<FlatPtr> Process::sys$getrusage(int who, Userspace<rusage*> user_usage)
|
|||
|
||||
switch (who) {
|
||||
case RUSAGE_SELF:
|
||||
usage.ru_utime = Time::from_ticks(m_ticks_in_user, ticks_per_second).to_timeval();
|
||||
usage.ru_stime = Time::from_ticks(m_ticks_in_kernel, ticks_per_second).to_timeval();
|
||||
usage.ru_utime = Duration::from_ticks(m_ticks_in_user, ticks_per_second).to_timeval();
|
||||
usage.ru_stime = Duration::from_ticks(m_ticks_in_kernel, ticks_per_second).to_timeval();
|
||||
break;
|
||||
case RUSAGE_CHILDREN:
|
||||
usage.ru_utime = Time::from_ticks(m_ticks_in_user_for_dead_children, ticks_per_second).to_timeval();
|
||||
usage.ru_stime = Time::from_ticks(m_ticks_in_kernel_for_dead_children, ticks_per_second).to_timeval();
|
||||
usage.ru_utime = Duration::from_ticks(m_ticks_in_user_for_dead_children, ticks_per_second).to_timeval();
|
||||
usage.ru_stime = Duration::from_ticks(m_ticks_in_kernel_for_dead_children, ticks_per_second).to_timeval();
|
||||
break;
|
||||
default:
|
||||
return EINVAL;
|
||||
|
|
|
@ -272,7 +272,7 @@ ErrorOr<FlatPtr> Process::sys$recvmsg(int sockfd, Userspace<struct msghdr*> user
|
|||
return 0;
|
||||
|
||||
auto data_buffer = TRY(UserOrKernelBuffer::for_user_buffer((u8*)iovs[0].iov_base, iovs[0].iov_len));
|
||||
Time timestamp {};
|
||||
Duration timestamp {};
|
||||
bool blocking = (flags & MSG_DONTWAIT) ? false : description->is_blocking();
|
||||
auto result = socket.recvfrom(*description, data_buffer, iovs[0].iov_len, flags, user_addr, user_addr_length, timestamp, blocking);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue