unsubmitted-clock_t_centiseconds
authorGNU Libc Maintainers <debian-glibc@lists.debian.org>
Wed, 30 Apr 2025 01:01:35 +0000 (09:01 +0800)
committerSean Whitton <spwhitton@spwhitton.name>
Wed, 30 Apr 2025 01:01:35 +0000 (09:01 +0800)
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
sysdeps/mach/hurd/setitimer.c
sysdeps/mach/hurd/times.c

index 943e36e805e672c133a293e97ec6c1c0fd065f4f..5a3cf0930b9601f6fcaeb5383de7e02eafebaba4 100644 (file)
 
 #include <time.h>
 
-/* 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
index a2b6c2aa5d0aaad93d7363f84da5ec5e65a3ba9f..45301975073613945192936344ad738030d0ee60 100644 (file)
@@ -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)
index 23ed9927832d7e4da9f35819f23b9b466c009c20..cbf6039b1923c4556a0034e5f69b3f6ecf5090b6 100644 (file)
@@ -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