1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 17:37:34 +00:00

Kernel: Make kgettimeofday use AK::Time

This commit is contained in:
Ben Wiederhake 2021-02-28 02:18:48 +01:00 committed by Andreas Kling
parent 05d5e3fad9
commit 336303bda4
11 changed files with 28 additions and 26 deletions

View file

@ -135,7 +135,7 @@ KResultOr<int> Process::sys$adjtime(Userspace<const timeval*> user_delta, Usersp
KResultOr<int> Process::sys$gettimeofday(Userspace<timeval*> user_tv)
{
REQUIRE_PROMISE(stdio);
auto tv = kgettimeofday();
auto tv = kgettimeofday().to_timeval();
if (!copy_to_user(user_tv, &tv))
return EFAULT;
return 0;

View file

@ -41,8 +41,9 @@ KResultOr<int> Process::sys$utime(Userspace<const char*> user_path, size_t path_
if (!copy_from_user(&buf, user_buf))
return EFAULT;
} else {
auto now = kgettimeofday();
buf = { now.tv_sec, now.tv_sec };
auto now = kgettimeofday().to_truncated_seconds();
// Not a bug!
buf = { now, now };
}
return VFS::the().utime(path.value(), current_directory(), buf.actime, buf.modtime);
}