1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:28:11 +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

@ -8,6 +8,7 @@
#include <AK/Error.h>
#include <AK/Span.h>
#include <AK/Time.h>
#include <Kernel/FileSystem/DeviceFileTypes.h>
#include <Kernel/FileSystem/InodeIdentifier.h>
#include <Kernel/Forward.h>
@ -106,12 +107,9 @@ struct InodeMetadata {
buffer.st_size = size;
buffer.st_blksize = block_size;
buffer.st_blocks = block_count;
buffer.st_atim.tv_sec = atime;
buffer.st_atim.tv_nsec = 0;
buffer.st_mtim.tv_sec = mtime;
buffer.st_mtim.tv_nsec = 0;
buffer.st_ctim.tv_sec = ctime;
buffer.st_ctim.tv_nsec = 0;
buffer.st_atim = atime.to_timespec();
buffer.st_mtim = mtime.to_timespec();
buffer.st_ctim = ctime.to_timespec();
return buffer;
}
@ -121,10 +119,10 @@ struct InodeMetadata {
UserID uid { 0 };
GroupID gid { 0 };
nlink_t link_count { 0 };
time_t atime { 0 };
time_t ctime { 0 };
time_t mtime { 0 };
time_t dtime { 0 };
Time atime {};
Time ctime {};
Time mtime {};
Time dtime {};
blkcnt_t block_count { 0 };
blksize_t block_size { 0 };
MajorNumber major_device { 0 };