mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 23:09:08 +00:00
Kernel: Do timekeeping manually instead of asking the RTC all the time.
This introduces a tiny amount of timer drift which I will have to fix somehow eventually, but it's a huge improvement in timing consistency as we no longer suddenly jump from e.g 10:45:49.123 to 10:45:50.000.
This commit is contained in:
parent
20f7d7ec67
commit
ab11f42094
Notes:
sideshowbarker
2024-07-19 14:57:04 +09:00
Author: https://github.com/awesomekling
Commit: ab11f42094
5 changed files with 34 additions and 21 deletions
|
@ -915,9 +915,10 @@ int Process::sys$utime(const char* pathname, const utimbuf* buf)
|
|||
atime = buf->actime;
|
||||
mtime = buf->modtime;
|
||||
} else {
|
||||
auto now = RTC::now();
|
||||
mtime = now;
|
||||
atime = now;
|
||||
struct timeval now;
|
||||
kgettimeofday(now);
|
||||
mtime = now.tv_sec;
|
||||
atime = now.tv_sec;
|
||||
}
|
||||
return VFS::the().utime(String(pathname), cwd_inode(), atime, mtime);
|
||||
}
|
||||
|
@ -1238,8 +1239,8 @@ int Process::sys$sleep(unsigned seconds)
|
|||
|
||||
void kgettimeofday(timeval& tv)
|
||||
{
|
||||
tv.tv_sec = RTC::now();
|
||||
tv.tv_usec = (PIT::ticks_since_boot() % 1000) * 1000;
|
||||
tv.tv_sec = RTC::boot_time() + PIT::seconds_since_boot();
|
||||
tv.tv_usec = PIT::ticks_this_second() * 1000;
|
||||
}
|
||||
|
||||
int Process::sys$gettimeofday(timeval* tv)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue