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. */
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;
}
\f
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);
# 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)
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
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;
}
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);
}
}
/* 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)
{