unsubmitted-clock_t_centiseconds
authorGNU Libc Maintainers <debian-glibc@lists.debian.org>
Sun, 10 Jul 2022 20:29:34 +0000 (21:29 +0100)
committerAurelien Jarno <aurel32@debian.org>
Sun, 10 Jul 2022 20:29:34 +0000 (21:29 +0100)
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 26fe38fcf55b0c5bfed3c3ed9cadf57f40ba496f..f941c3f5807cf5de42fcbd8cc2239e8e2db10c03 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 80b00e64d43535287d28e58ae0675e8d9488acfe..4c525a0bf95234ebb4851655e81af4adea54d7c1 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 1c278658dfbdb03259df642b4aa5480986ccebdd..d3447200f144826a0c7b352058c0df03f66890a4 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