unsubmitted-clock_t_centiseconds
authorGNU Libc Maintainers <debian-glibc@lists.debian.org>
Tue, 24 Sep 2024 19:46:16 +0000 (21:46 +0200)
committerAurelien Jarno <aurel32@debian.org>
Tue, 24 Sep 2024 19:46:16 +0000 (21:46 +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 ecafac804374d0dae2010113c4addcf9ba1122ff..5b20f36844efc0886a822f2e1d3645242364a78b 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 2b60d9f2ad245c8949392fa1e03509eb2f5ee128..e5e9d60be074f0939d45e2b0674d4e7b2540b333 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 3e384dd6a509098fb3a5a46dbdb7b299105daf30..54ce6f99bd085c2c6dce2a346efd729c8c74f8e6 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