unsubmitted-clock_t_centiseconds
authorGNU Libc Maintainers <debian-glibc@lists.debian.org>
Mon, 10 Jun 2024 20:25:19 +0000 (22:25 +0200)
committerSamuel Thibault <sthibault@debian.org>
Mon, 10 Jun 2024 20:25:19 +0000 (22:25 +0200)
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 5127b425ba12056d2b58c96fac5f25260ec52bdf..a400c956f4247f5c644955b8bd0e8f5e1da624ca 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 7c150a503507d25f048cc4962329389388613ae1..68fbd8a0920d2264bc35a0ba29be58ecb1107f2a 100644 (file)
@@ -44,7 +44,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 a9403380b4d1b9f07b1efec8eb4aba73a03b8100..ae4c5e71b53a03fb9d7ac780bd571d34175fd9be 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;
 }
 
 #ifdef HAVE_HURD_PROC_GETCHILDREN_RUSAGE