summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMike Belopuhov <mikeb@cvs.openbsd.org>2015-06-11 16:03:05 +0000
committerMike Belopuhov <mikeb@cvs.openbsd.org>2015-06-11 16:03:05 +0000
commit81117977f28e6563249535ac2a09136f55e0abd5 (patch)
treea9fa207be29f77ab6b3bcf2278021491dd3987fe /sys
parent30b5a0932c72a4a80aa7dde7cc54fc06b25953f8 (diff)
Move hzto(9) to the attic; OK dlg
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_clock.c55
-rw-r--r--sys/sys/systm.h3
2 files changed, 2 insertions, 56 deletions
diff --git a/sys/kern/kern_clock.c b/sys/kern/kern_clock.c
index 279804c9b75..adaaab0a73e 100644
--- a/sys/kern/kern_clock.c
+++ b/sys/kern/kern_clock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_clock.c,v 1.87 2014/09/15 19:08:21 miod Exp $ */
+/* $OpenBSD: kern_clock.c,v 1.88 2015/06/11 16:03:04 mikeb Exp $ */
/* $NetBSD: kern_clock.c,v 1.34 1996/06/09 04:51:03 briggs Exp $ */
/*-
@@ -202,59 +202,6 @@ hardclock(struct clockframe *frame)
}
/*
- * Compute number of hz until specified time. Used to
- * compute the second argument to timeout_add() from an absolute time.
- */
-int
-hzto(const struct timeval *tv)
-{
- struct timeval now;
- unsigned long nticks;
- long sec, usec;
-
- /*
- * If the number of usecs in the whole seconds part of the time
- * difference fits in a long, then the total number of usecs will
- * fit in an unsigned long. Compute the total and convert it to
- * ticks, rounding up and adding 1 to allow for the current tick
- * to expire. Rounding also depends on unsigned long arithmetic
- * to avoid overflow.
- *
- * Otherwise, if the number of ticks in the whole seconds part of
- * the time difference fits in a long, then convert the parts to
- * ticks separately and add, using similar rounding methods and
- * overflow avoidance. This method would work in the previous
- * case but it is slightly slower and assumes that hz is integral.
- *
- * Otherwise, round the time difference down to the maximum
- * representable value.
- *
- * If ints have 32 bits, then the maximum value for any timeout in
- * 10ms ticks is 248 days.
- */
- getmicrotime(&now);
- sec = tv->tv_sec - now.tv_sec;
- usec = tv->tv_usec - now.tv_usec;
- if (usec < 0) {
- sec--;
- usec += 1000000;
- }
- if (sec < 0 || (sec == 0 && usec <= 0)) {
- nticks = 0;
- } else if (sec <= LONG_MAX / 1000000)
- nticks = (sec * 1000000 + (unsigned long)usec + (tick - 1))
- / tick + 1;
- else if (sec <= LONG_MAX / hz)
- nticks = sec * hz
- + ((unsigned long)usec + (tick - 1)) / tick + 1;
- else
- nticks = LONG_MAX;
- if (nticks > INT_MAX)
- nticks = INT_MAX;
- return ((int)nticks);
-}
-
-/*
* Compute number of hz in the specified amount of time.
*/
int
diff --git a/sys/sys/systm.h b/sys/sys/systm.h
index 26f1f575bae..eef9a71568a 100644
--- a/sys/sys/systm.h
+++ b/sys/sys/systm.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: systm.h,v 1.107 2015/02/10 21:56:10 miod Exp $ */
+/* $OpenBSD: systm.h,v 1.108 2015/06/11 16:03:04 mikeb Exp $ */
/* $NetBSD: systm.h,v 1.50 1996/06/09 04:55:09 briggs Exp $ */
/*-
@@ -222,7 +222,6 @@ u_int32_t arc4random_uniform(u_int32_t);
struct timeval;
struct timespec;
-int hzto(const struct timeval *);
int tvtohz(const struct timeval *);
int tstohz(const struct timespec *);
void realitexpire(void *);