kernel: preserve microsecond wall-clock resolution

Extracted from 3db2b3c5c5e1a26a861df7ebcacd9ccb8c484420 in KytyPS5/KytyPS5#147.
This commit is contained in:
Stefanos Costa authored and nmzik committed 2026-08-02 06:35:52 +02:00
1 parent 66f640527d
commit 0b6bf01b36
2 files changed
+13 -16

No files matched your search

+6 -2
View File
@@ -3886,8 +3886,12 @@ int KYTY_SYSV_ABI KernelGettimeofday(KernelTimeval* tp) {
tp->tv_sec = static_cast<int64_t>(ticks / 1000000);
tp->tv_usec = static_cast<int64_t>(ticks % 1000000);
#else
auto dt = Common::DateTime::FromSystemUTC();
sec_to_timeval(tp, dt.ToUnix());
struct timespec ts {};
result = ::clock_gettime(CLOCK_REALTIME, &ts);
if (result == 0) {
tp->tv_sec = static_cast<int64_t>(ts.tv_sec);
tp->tv_usec = static_cast<int64_t>(ts.tv_nsec / 1000);
}
#endif
if (result == 0) {