1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 14:25:08 +00:00

Kernel: Use AK::Time for InodeMetadata timestamps instead of time_t

Before this change, we were truncating the nanosecond part of file
timestamps in many different places.
This commit is contained in:
Andreas Kling 2022-11-22 21:01:45 +01:00
parent f8290e1ad4
commit 10fa72d451
23 changed files with 56 additions and 58 deletions

View file

@ -28,7 +28,7 @@ ErrorOr<NonnullLockRefPtr<TmpFSInode>> TmpFSInode::try_create(TmpFS& fs, InodeMe
ErrorOr<NonnullLockRefPtr<TmpFSInode>> TmpFSInode::try_create_root(TmpFS& fs)
{
InodeMetadata metadata;
auto now = kgettimeofday().to_truncated_seconds();
auto now = kgettimeofday();
metadata.atime = now;
metadata.ctime = now;
metadata.mtime = now;
@ -266,7 +266,7 @@ ErrorOr<void> TmpFSInode::chown(UserID uid, GroupID gid)
ErrorOr<NonnullLockRefPtr<Inode>> TmpFSInode::create_child(StringView name, mode_t mode, dev_t dev, UserID uid, GroupID gid)
{
MutexLocker locker(m_inode_lock);
time_t now = kgettimeofday().to_truncated_seconds();
auto now = kgettimeofday();
InodeMetadata metadata;
metadata.mode = mode;
@ -352,7 +352,7 @@ ErrorOr<void> TmpFSInode::truncate(u64 size)
return {};
}
ErrorOr<void> TmpFSInode::update_timestamps(Optional<time_t> atime, Optional<time_t> ctime, Optional<time_t> mtime)
ErrorOr<void> TmpFSInode::update_timestamps(Optional<Time> atime, Optional<Time> ctime, Optional<Time> mtime)
{
MutexLocker locker(m_inode_lock);