From 709d7e603ffea961dcea6b4e4da540d4206d9cfa Mon Sep 17 00:00:00 2001 From: GNU Libc Maintainers Date: Sun, 25 Dec 2022 18:42:32 +0000 Subject: [PATCH] unsubmitted-clock_t_centiseconds Some applications assume centisecond precision, or at most millisecond precision (e.g. guile). This is a work-around for them. Gbp-Pq: Topic hurd-i386 Gbp-Pq: Name unsubmitted-clock_t_centiseconds.diff --- sysdeps/mach/hurd/getclktck.c | 5 ++--- sysdeps/mach/hurd/setitimer.c | 2 +- sysdeps/mach/hurd/times.c | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/sysdeps/mach/hurd/getclktck.c b/sysdeps/mach/hurd/getclktck.c index 771493a03..05c9f602a 100644 --- a/sysdeps/mach/hurd/getclktck.c +++ b/sysdeps/mach/hurd/getclktck.c @@ -18,12 +18,11 @@ #include -/* Return frequency of `times'. - Since Mach reports CPU times in microseconds, we always use 1 million. */ +/* Return frequency of `times'. */ int __getclktck (void) { - return 1000000; + return 100; } /* Before glibc 2.2, the Hurd actually did this differently, so we diff --git a/sysdeps/mach/hurd/setitimer.c b/sysdeps/mach/hurd/setitimer.c index 7540f73a8..ec64ec6f6 100644 --- a/sysdeps/mach/hurd/setitimer.c +++ b/sysdeps/mach/hurd/setitimer.c @@ -43,7 +43,7 @@ quantize_timeval (struct timeval *tv) static time_t quantum = -1; if (quantum == -1) - quantum = 1000000 / __getclktck (); + quantum = 100 / __getclktck (); tv->tv_usec = ((tv->tv_usec + (quantum - 1)) / quantum) * quantum; if (tv->tv_usec >= 1000000) diff --git a/sysdeps/mach/hurd/times.c b/sysdeps/mach/hurd/times.c index b6a5158c4..37be1dbb9 100644 --- a/sysdeps/mach/hurd/times.c +++ b/sysdeps/mach/hurd/times.c @@ -29,7 +29,7 @@ static inline clock_t clock_from_time_value (const time_value_t *t) { - return t->seconds * 1000000 + t->microseconds; + return t->seconds * 100 + t->microseconds / 10000; } /* Store the CPU time used by this process and all its -- 2.30.2