unsubmitted-clock_t_centiseconds
authorGNU Libc Maintainers <debian-glibc@lists.debian.org>
Fri, 5 Jan 2018 18:09:39 +0000 (18:09 +0000)
committerAurelien Jarno <aurel32@debian.org>
Fri, 5 Jan 2018 18:09:39 +0000 (18:09 +0000)
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 08b787a13545f86d809204a3ebc9a5b95f1b0084..672f16a377edcec2d9be83bfc4e60ec317a21eed 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 e003c996b6612b9f161164a99b5597ea66198d3c..f992d8f2e91375a57829417a379866a6328dc979 100644 (file)
@@ -42,7 +42,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 10ba2f7cb77ec1616b5470ff8f685874bc311f1f..3992a5cba32e09faa75d8c0e38a7dd3cb5eb450a 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