diff options
| author | Paul Eggert | 2018-09-10 21:22:05 -0700 |
|---|---|---|
| committer | Paul Eggert | 2018-09-10 21:22:54 -0700 |
| commit | ef93983344e748124ac9bc218700cee14a0df947 (patch) | |
| tree | 0d76e8c9a0a381082608f445ddc69ec9f7a7e311 /src | |
| parent | fc389d3a836c11893ac5c5894915e9b8b4868799 (diff) | |
| download | emacs-ef93983344e748124ac9bc218700cee14a0df947.tar.gz emacs-ef93983344e748124ac9bc218700cee14a0df947.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/gtkutil.c | 2 | ||||
| -rw-r--r-- | src/process.c | 4 | ||||
| -rw-r--r-- | src/sysdep.c | 17 | ||||
| -rw-r--r-- | src/systime.h | 4 |
4 files changed, 13 insertions, 14 deletions
diff --git a/src/gtkutil.c b/src/gtkutil.c index 4250355a2f6..6212e1af4e8 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c | |||
| @@ -1867,7 +1867,7 @@ xg_maybe_add_timer (gpointer data) | |||
| 1867 | if (timespec_valid_p (next_time)) | 1867 | if (timespec_valid_p (next_time)) |
| 1868 | { | 1868 | { |
| 1869 | time_t s = next_time.tv_sec; | 1869 | time_t s = next_time.tv_sec; |
| 1870 | int per_ms = TIMESPEC_RESOLUTION / 1000; | 1870 | int per_ms = TIMESPEC_HZ / 1000; |
| 1871 | int ms = (next_time.tv_nsec + per_ms - 1) / per_ms; | 1871 | int ms = (next_time.tv_nsec + per_ms - 1) / per_ms; |
| 1872 | if (s <= ((guint) -1 - ms) / 1000) | 1872 | if (s <= ((guint) -1 - ms) / 1000) |
| 1873 | dd->timerid = g_timeout_add (s * 1000 + ms, xg_maybe_add_timer, dd); | 1873 | dd->timerid = g_timeout_add (s * 1000 + ms, xg_maybe_add_timer, dd); |
diff --git a/src/process.c b/src/process.c index 4d96e469767..b4ba641f31b 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -252,7 +252,7 @@ static EMACS_INT update_tick; | |||
| 252 | # define HAVE_SEQPACKET | 252 | # define HAVE_SEQPACKET |
| 253 | #endif | 253 | #endif |
| 254 | 254 | ||
| 255 | #define READ_OUTPUT_DELAY_INCREMENT (TIMESPEC_RESOLUTION / 100) | 255 | #define READ_OUTPUT_DELAY_INCREMENT (TIMESPEC_HZ / 100) |
| 256 | #define READ_OUTPUT_DELAY_MAX (READ_OUTPUT_DELAY_INCREMENT * 5) | 256 | #define READ_OUTPUT_DELAY_MAX (READ_OUTPUT_DELAY_INCREMENT * 5) |
| 257 | #define READ_OUTPUT_DELAY_MAX_MAX (READ_OUTPUT_DELAY_INCREMENT * 7) | 257 | #define READ_OUTPUT_DELAY_MAX_MAX (READ_OUTPUT_DELAY_INCREMENT * 7) |
| 258 | 258 | ||
| @@ -5478,7 +5478,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | |||
| 5478 | have waited a long amount of time due to repeated | 5478 | have waited a long amount of time due to repeated |
| 5479 | timers. */ | 5479 | timers. */ |
| 5480 | struct timespec huge_timespec | 5480 | struct timespec huge_timespec |
| 5481 | = make_timespec (TYPE_MAXIMUM (time_t), 2 * TIMESPEC_RESOLUTION); | 5481 | = make_timespec (TYPE_MAXIMUM (time_t), 2 * TIMESPEC_HZ); |
| 5482 | struct timespec cmp_time = huge_timespec; | 5482 | struct timespec cmp_time = huge_timespec; |
| 5483 | if (wait < TIMEOUT | 5483 | if (wait < TIMEOUT |
| 5484 | || (wait_proc | 5484 | || (wait_proc |
diff --git a/src/sysdep.c b/src/sysdep.c index 52afa2f0e16..ecbbbbc0ef3 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -3078,16 +3078,15 @@ time_from_jiffies (unsigned long long tval, long hz) | |||
| 3078 | 3078 | ||
| 3079 | if (TYPE_MAXIMUM (time_t) < s) | 3079 | if (TYPE_MAXIMUM (time_t) < s) |
| 3080 | time_overflow (); | 3080 | time_overflow (); |
| 3081 | if (LONG_MAX - 1 <= ULLONG_MAX / TIMESPEC_RESOLUTION | 3081 | if (LONG_MAX - 1 <= ULLONG_MAX / TIMESPEC_HZ |
| 3082 | || frac <= ULLONG_MAX / TIMESPEC_RESOLUTION) | 3082 | || frac <= ULLONG_MAX / TIMESPEC_HZ) |
| 3083 | ns = frac * TIMESPEC_RESOLUTION / hz; | 3083 | ns = frac * TIMESPEC_HZ / hz; |
| 3084 | else | 3084 | else |
| 3085 | { | 3085 | { |
| 3086 | /* This is reachable only in the unlikely case that HZ * HZ | 3086 | /* This is reachable only in the unlikely case that HZ * HZ |
| 3087 | exceeds ULLONG_MAX. It calculates an approximation that is | 3087 | exceeds ULLONG_MAX. It calculates an approximation that is |
| 3088 | guaranteed to be in range. */ | 3088 | guaranteed to be in range. */ |
| 3089 | long hz_per_ns = (hz / TIMESPEC_RESOLUTION | 3089 | long hz_per_ns = hz / TIMESPEC_HZ + (hz % TIMESPEC_HZ != 0); |
| 3090 | + (hz % TIMESPEC_RESOLUTION != 0)); | ||
| 3091 | ns = frac / hz_per_ns; | 3090 | ns = frac / hz_per_ns; |
| 3092 | } | 3091 | } |
| 3093 | 3092 | ||
| @@ -3123,16 +3122,16 @@ get_up_time (void) | |||
| 3123 | if (TYPE_MAXIMUM (time_t) < upsec) | 3122 | if (TYPE_MAXIMUM (time_t) < upsec) |
| 3124 | { | 3123 | { |
| 3125 | upsec = TYPE_MAXIMUM (time_t); | 3124 | upsec = TYPE_MAXIMUM (time_t); |
| 3126 | upfrac = TIMESPEC_RESOLUTION - 1; | 3125 | upfrac = TIMESPEC_HZ - 1; |
| 3127 | } | 3126 | } |
| 3128 | else | 3127 | else |
| 3129 | { | 3128 | { |
| 3130 | int upfraclen = upfrac_end - upfrac_start; | 3129 | int upfraclen = upfrac_end - upfrac_start; |
| 3131 | for (; upfraclen < LOG10_TIMESPEC_RESOLUTION; upfraclen++) | 3130 | for (; upfraclen < LOG10_TIMESPEC_HZ; upfraclen++) |
| 3132 | upfrac *= 10; | 3131 | upfrac *= 10; |
| 3133 | for (; LOG10_TIMESPEC_RESOLUTION < upfraclen; upfraclen--) | 3132 | for (; LOG10_TIMESPEC_HZ < upfraclen; upfraclen--) |
| 3134 | upfrac /= 10; | 3133 | upfrac /= 10; |
| 3135 | upfrac = min (upfrac, TIMESPEC_RESOLUTION - 1); | 3134 | upfrac = min (upfrac, TIMESPEC_HZ - 1); |
| 3136 | } | 3135 | } |
| 3137 | up = make_timespec (upsec, upfrac); | 3136 | up = make_timespec (upsec, upfrac); |
| 3138 | } | 3137 | } |
diff --git a/src/systime.h b/src/systime.h index b2f893714b3..ede3d4eb12d 100644 --- a/src/systime.h +++ b/src/systime.h | |||
| @@ -58,8 +58,8 @@ invalid_timespec (void) | |||
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | /* Return true if TIME is a valid timespec. This currently doesn't worry | 60 | /* Return true if TIME is a valid timespec. This currently doesn't worry |
| 61 | about whether tv_nsec is less than TIMESPEC_RESOLUTION; leap seconds | 61 | about whether tv_nsec is less than TIMESPEC_HZ; leap seconds might |
| 62 | might cause a problem if it did. */ | 62 | cause a problem if it did. */ |
| 63 | INLINE bool | 63 | INLINE bool |
| 64 | timespec_valid_p (struct timespec t) | 64 | timespec_valid_p (struct timespec t) |
| 65 | { | 65 | { |