Closed coltonmercurio closed 8 years ago
Thanks for the patch. Yes, there is indeed some discrepancy between the system time and filesystem time. But not only on the hour scale, but also on the second scale, because the system time (emulated) ) can be different from the filesystem time (Javascript function). I don't think, that I can perfectly synchronize them.
Has been a while since I've looked over the codebase or at how the kernel handles fetching timestamps, but perhaps date/time skew in at least CLOCK_REALTIME
could be fixed more generically w/ a realtime clock peripheral and a few kernel tweaks?
Linux syncs its clock exactly one time at boot time with a hardware real time clock. Then it relies fully on the normal timers and calculates the real time itself. I check every 10-20 times a second the Javaxcript realtime (only ms accuray) with the timers and recalculate the "clock cycle per instruction" counter. If it too far off (I think half a second) I reset my counters. Then Javascript and the emulation is out of sync. This happens not so often. With this synchronization trick I also get real time micro second accuracy for the sound emulation.
There is a significant difference between files access/modified time and the system time.
This causes issues with programs that compare the system time with file modification time (make).
This has been fixed by changing the following: