mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 23:37:36 +00:00
Kernel: Make kgettimeofday use AK::Time
This commit is contained in:
parent
05d5e3fad9
commit
336303bda4
11 changed files with 28 additions and 26 deletions
|
@ -572,7 +572,7 @@ void Ext2FS::free_inode(Ext2FSInode& inode)
|
|||
|
||||
// NOTE: After this point, the inode metadata is wiped.
|
||||
memset(&inode.m_raw_inode, 0, sizeof(ext2_inode));
|
||||
inode.m_raw_inode.i_dtime = kgettimeofday().tv_sec;
|
||||
inode.m_raw_inode.i_dtime = kgettimeofday().to_truncated_seconds();
|
||||
write_ext2_inode(inode.index(), inode.m_raw_inode);
|
||||
|
||||
// Mark the inode as free.
|
||||
|
@ -1429,14 +1429,14 @@ KResultOr<NonnullRefPtr<Inode>> Ext2FS::create_inode(Ext2FSInode& parent_inode,
|
|||
return ENOENT;
|
||||
|
||||
ext2_inode e2inode {};
|
||||
auto now = kgettimeofday();
|
||||
auto now = kgettimeofday().to_truncated_seconds();
|
||||
e2inode.i_mode = mode;
|
||||
e2inode.i_uid = uid;
|
||||
e2inode.i_gid = gid;
|
||||
e2inode.i_size = 0;
|
||||
e2inode.i_atime = now.tv_sec;
|
||||
e2inode.i_ctime = now.tv_sec;
|
||||
e2inode.i_mtime = now.tv_sec;
|
||||
e2inode.i_atime = now;
|
||||
e2inode.i_ctime = now;
|
||||
e2inode.i_mtime = now;
|
||||
e2inode.i_dtime = 0;
|
||||
e2inode.i_flags = 0;
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ KResultOr<size_t> InodeFile::write(FileDescription& description, size_t offset,
|
|||
|
||||
ssize_t nwritten = m_inode->write_bytes(offset, count, data, &description);
|
||||
if (nwritten > 0) {
|
||||
m_inode->set_mtime(kgettimeofday().tv_sec);
|
||||
m_inode->set_mtime(kgettimeofday().to_truncated_seconds());
|
||||
Thread::current()->did_file_write(nwritten);
|
||||
evaluate_block_conditions();
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ KResult InodeFile::truncate(u64 size)
|
|||
auto truncate_result = m_inode->truncate(size);
|
||||
if (truncate_result.is_error())
|
||||
return truncate_result;
|
||||
int mtime_result = m_inode->set_mtime(kgettimeofday().tv_sec);
|
||||
int mtime_result = m_inode->set_mtime(kgettimeofday().to_truncated_seconds());
|
||||
if (mtime_result < 0)
|
||||
return KResult((ErrnoCode)-mtime_result);
|
||||
return KSuccess;
|
||||
|
|
|
@ -114,10 +114,10 @@ NonnullRefPtr<TmpFSInode> TmpFSInode::create(TmpFS& fs, InodeMetadata metadata,
|
|||
NonnullRefPtr<TmpFSInode> TmpFSInode::create_root(TmpFS& fs)
|
||||
{
|
||||
InodeMetadata metadata;
|
||||
auto now = kgettimeofday();
|
||||
metadata.atime = now.tv_sec;
|
||||
metadata.ctime = now.tv_sec;
|
||||
metadata.mtime = now.tv_sec;
|
||||
auto now = kgettimeofday().to_truncated_seconds();
|
||||
metadata.atime = now;
|
||||
metadata.ctime = now;
|
||||
metadata.mtime = now;
|
||||
metadata.mode = S_IFDIR | S_ISVTX | 0777;
|
||||
return create(fs, metadata, { fs.fsid(), 1 });
|
||||
}
|
||||
|
@ -280,15 +280,15 @@ KResultOr<NonnullRefPtr<Inode>> TmpFSInode::create_child(const String& name, mod
|
|||
if (dev != 0)
|
||||
return ENOTSUP;
|
||||
|
||||
struct timeval now = kgettimeofday();
|
||||
time_t now = kgettimeofday().to_truncated_seconds();
|
||||
|
||||
InodeMetadata metadata;
|
||||
metadata.mode = mode;
|
||||
metadata.uid = uid;
|
||||
metadata.gid = gid;
|
||||
metadata.atime = now.tv_sec;
|
||||
metadata.ctime = now.tv_sec;
|
||||
metadata.mtime = now.tv_sec;
|
||||
metadata.atime = now;
|
||||
metadata.ctime = now;
|
||||
metadata.mtime = now;
|
||||
|
||||
auto child = TmpFSInode::create(fs(), metadata, identifier());
|
||||
auto result = add_child(child, name, mode);
|
||||
|
|
|
@ -346,7 +346,7 @@ KResultOr<NonnullRefPtr<FileDescription>> VFS::open(StringView path, int options
|
|||
KResult result = inode.truncate(0);
|
||||
if (result.is_error())
|
||||
return result;
|
||||
inode.set_mtime(kgettimeofday().tv_sec);
|
||||
inode.set_mtime(kgettimeofday().to_truncated_seconds());
|
||||
}
|
||||
auto description = FileDescription::create(custody);
|
||||
if (!description.is_error()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue