emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master ef93983 2/2: Adjust to TIMESPEC_HZ renaming


From: Paul Eggert
Subject: [Emacs-diffs] master ef93983 2/2: Adjust to TIMESPEC_HZ renaming
Date: Tue, 11 Sep 2018 00:23:00 -0400 (EDT)

branch: master
commit ef93983344e748124ac9bc218700cee14a0df947
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    Adjust to TIMESPEC_HZ renaming
    
    Adjust to lib/timespec.h’s renaming of TIMESPEC_RESOLUTION and
    LOG10_TIMESPEC_RESOLUTION to TIMESPEC_HZ and
    LOG10_TIMESPEC_HZ.  The old names were misnomers.
    All uses changed.
---
 lib-src/profile.c |  4 ++--
 src/gtkutil.c     |  2 +-
 src/process.c     |  4 ++--
 src/sysdep.c      | 17 ++++++++---------
 src/systime.h     |  4 ++--
 5 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/lib-src/profile.c b/lib-src/profile.c
index 3818d33..cccdfbc 100644
--- a/lib-src/profile.c
+++ b/lib-src/profile.c
@@ -43,7 +43,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 static struct timespec TV1;
 static int watch_not_started = 1; /* flag */
 static char time_string[INT_STRLEN_BOUND (uintmax_t) + sizeof "."
-                       + LOG10_TIMESPEC_RESOLUTION];
+                       + LOG10_TIMESPEC_HZ];
 
 /* Reset the stopwatch to zero.  */
 
@@ -66,7 +66,7 @@ get_time (void)
   int ns = TV2.tv_nsec;
   if (watch_not_started)
     exit (EXIT_FAILURE);  /* call reset_watch first ! */
-  sprintf (time_string, "%"PRIuMAX".%0*d", s, LOG10_TIMESPEC_RESOLUTION, ns);
+  sprintf (time_string, "%"PRIuMAX".%0*d", s, LOG10_TIMESPEC_HZ, ns);
   return time_string;
 }
 
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 4250355..6212e1a 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -1867,7 +1867,7 @@ xg_maybe_add_timer (gpointer data)
   if (timespec_valid_p (next_time))
     {
       time_t s = next_time.tv_sec;
-      int per_ms = TIMESPEC_RESOLUTION / 1000;
+      int per_ms = TIMESPEC_HZ / 1000;
       int ms = (next_time.tv_nsec + per_ms - 1) / per_ms;
       if (s <= ((guint) -1 - ms) / 1000)
        dd->timerid = g_timeout_add (s * 1000 + ms, xg_maybe_add_timer, dd);
diff --git a/src/process.c b/src/process.c
index 4d96e46..b4ba641 100644
--- a/src/process.c
+++ b/src/process.c
@@ -252,7 +252,7 @@ static EMACS_INT update_tick;
 # define HAVE_SEQPACKET
 #endif
 
-#define READ_OUTPUT_DELAY_INCREMENT (TIMESPEC_RESOLUTION / 100)
+#define READ_OUTPUT_DELAY_INCREMENT (TIMESPEC_HZ / 100)
 #define READ_OUTPUT_DELAY_MAX       (READ_OUTPUT_DELAY_INCREMENT * 5)
 #define READ_OUTPUT_DELAY_MAX_MAX   (READ_OUTPUT_DELAY_INCREMENT * 7)
 
@@ -5478,7 +5478,7 @@ wait_reading_process_output (intmax_t time_limit, int 
nsecs, int read_kbd,
              have waited a long amount of time due to repeated
              timers.  */
          struct timespec huge_timespec
-           = make_timespec (TYPE_MAXIMUM (time_t), 2 * TIMESPEC_RESOLUTION);
+           = make_timespec (TYPE_MAXIMUM (time_t), 2 * TIMESPEC_HZ);
          struct timespec cmp_time = huge_timespec;
          if (wait < TIMEOUT
               || (wait_proc
diff --git a/src/sysdep.c b/src/sysdep.c
index 52afa2f..ecbbbbc 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -3078,16 +3078,15 @@ time_from_jiffies (unsigned long long tval, long hz)
 
   if (TYPE_MAXIMUM (time_t) < s)
     time_overflow ();
-  if (LONG_MAX - 1 <= ULLONG_MAX / TIMESPEC_RESOLUTION
-      || frac <= ULLONG_MAX / TIMESPEC_RESOLUTION)
-    ns = frac * TIMESPEC_RESOLUTION / hz;
+  if (LONG_MAX - 1 <= ULLONG_MAX / TIMESPEC_HZ
+      || frac <= ULLONG_MAX / TIMESPEC_HZ)
+    ns = frac * TIMESPEC_HZ / hz;
   else
     {
       /* This is reachable only in the unlikely case that HZ * HZ
         exceeds ULLONG_MAX.  It calculates an approximation that is
         guaranteed to be in range.  */
-      long hz_per_ns = (hz / TIMESPEC_RESOLUTION
-                       + (hz % TIMESPEC_RESOLUTION != 0));
+      long hz_per_ns = hz / TIMESPEC_HZ + (hz % TIMESPEC_HZ != 0);
       ns = frac / hz_per_ns;
     }
 
@@ -3123,16 +3122,16 @@ get_up_time (void)
          if (TYPE_MAXIMUM (time_t) < upsec)
            {
              upsec = TYPE_MAXIMUM (time_t);
-             upfrac = TIMESPEC_RESOLUTION - 1;
+             upfrac = TIMESPEC_HZ - 1;
            }
          else
            {
              int upfraclen = upfrac_end - upfrac_start;
-             for (; upfraclen < LOG10_TIMESPEC_RESOLUTION; upfraclen++)
+             for (; upfraclen < LOG10_TIMESPEC_HZ; upfraclen++)
                upfrac *= 10;
-             for (; LOG10_TIMESPEC_RESOLUTION < upfraclen; upfraclen--)
+             for (; LOG10_TIMESPEC_HZ < upfraclen; upfraclen--)
                upfrac /= 10;
-             upfrac = min (upfrac, TIMESPEC_RESOLUTION - 1);
+             upfrac = min (upfrac, TIMESPEC_HZ - 1);
            }
          up = make_timespec (upsec, upfrac);
        }
diff --git a/src/systime.h b/src/systime.h
index b2f8937..ede3d4e 100644
--- a/src/systime.h
+++ b/src/systime.h
@@ -58,8 +58,8 @@ invalid_timespec (void)
 }
 
 /* Return true if TIME is a valid timespec.  This currently doesn't worry
-   about whether tv_nsec is less than TIMESPEC_RESOLUTION; leap seconds
-   might cause a problem if it did.  */
+   about whether tv_nsec is less than TIMESPEC_HZ; leap seconds might
+   cause a problem if it did.  */
 INLINE bool
 timespec_valid_p (struct timespec t)
 {



reply via email to

[Prev in Thread] Current Thread [Next in Thread]