diff options
author | Anton Kling <anton@kling.gg> | 2024-07-03 18:30:51 +0200 |
---|---|---|
committer | Anton Kling <anton@kling.gg> | 2024-07-03 18:30:51 +0200 |
commit | 4e7918753175dbd8fc38bc7c5b176517e1dbef2f (patch) | |
tree | 723b3b3503d7502f3ce5338aeb6964cb5fa4c246 /kernel/fs | |
parent | 658c4e9645bf46268ed13bf5ef76d0ba60a347b9 (diff) |
Kernel/Time: Improve time keeping
This makes use of TSC and now provides a file system interface for
userland programs to change the system time.
Diffstat (limited to 'kernel/fs')
-rw-r--r-- | kernel/fs/ext2.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/kernel/fs/ext2.c b/kernel/fs/ext2.c index 1eeafce..a61d5f2 100644 --- a/kernel/fs/ext2.c +++ b/kernel/fs/ext2.c @@ -6,6 +6,7 @@ #include <math.h> #include <string.h> #include <sys/stat.h> +#include <timer.h> #include <typedefs.h> #define EXT2_SUPERBLOCK_SECTOR 2 @@ -52,7 +53,7 @@ void cached_read_block(u32 block, void *address, size_t size, size_t offset) { continue; } if (cache[i].block_num == block) { - cache[i].last_use = pit_num_ms(); + cache[i].last_use = timer_get_uptime(); memcpy(address, cache[i].block + offset, size); return; } @@ -77,7 +78,7 @@ void cached_read_block(u32 block, void *address, size_t size, size_t offset) { } c->is_used = 1; c->block_num = block; - c->last_use = pit_num_ms(); + c->last_use = timer_get_uptime(); c->has_write = 0; raw_vfs_pread(mount_fd, c->block, block_byte_size, block * block_byte_size); cached_read_block(block, address, size, offset); |