mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:07:36 +00:00
Kernel: Use UnixDateTime wherever applicable
"Wherever applicable" = most places, actually :^), especially for networking and filesystem timestamps. This includes changes to unzip, which uses DOSPackedTime, since that is changed for the FAT file systems.
This commit is contained in:
parent
c1323febc2
commit
939600d2d4
41 changed files with 115 additions and 125 deletions
|
@ -44,7 +44,7 @@ ErrorOr<FlatPtr> Process::sys$clock_settime(clockid_t clock_id, Userspace<timesp
|
|||
if (!credentials->is_superuser())
|
||||
return EPERM;
|
||||
|
||||
auto time = TRY(copy_time_from_user(user_ts));
|
||||
auto time = UnixDateTime::epoch() + TRY(copy_time_from_user(user_ts));
|
||||
|
||||
switch (clock_id) {
|
||||
case CLOCK_REALTIME:
|
||||
|
@ -110,9 +110,8 @@ ErrorOr<FlatPtr> Process::sys$adjtime(Userspace<timeval const*> user_delta, User
|
|||
{
|
||||
VERIFY_NO_PROCESS_BIG_LOCK(this);
|
||||
if (user_old_delta) {
|
||||
timespec old_delta_ts = TimeManagement::the().remaining_epoch_time_adjustment();
|
||||
timeval old_delta;
|
||||
timespec_to_timeval(old_delta_ts, old_delta);
|
||||
auto old_delta_duration = TimeManagement::the().remaining_epoch_time_adjustment();
|
||||
auto old_delta = old_delta_duration.to_timeval();
|
||||
TRY(copy_to_user(user_old_delta, &old_delta));
|
||||
}
|
||||
|
||||
|
@ -123,8 +122,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::Duration internally
|
||||
TimeManagement::the().set_remaining_epoch_time_adjustment(delta.to_timespec());
|
||||
TimeManagement::the().set_remaining_epoch_time_adjustment(delta);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -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));
|
||||
Duration timestamp {};
|
||||
UnixDateTime 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);
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ ErrorOr<FlatPtr> Process::sys$utime(Userspace<char const*> user_path, size_t pat
|
|||
if (user_buf) {
|
||||
TRY(copy_from_user(&buf, user_buf));
|
||||
} else {
|
||||
auto now = kgettimeofday().to_truncated_seconds();
|
||||
auto now = kgettimeofday().truncated_seconds_since_epoch();
|
||||
// Not a bug!
|
||||
buf = { now, now };
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue