summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_timeout.c14
-rw-r--r--sys/sys/timeout.h3
2 files changed, 15 insertions, 2 deletions
diff --git a/sys/kern/kern_timeout.c b/sys/kern/kern_timeout.c
index 9a8afbf2c55..492a892fe4b 100644
--- a/sys/kern/kern_timeout.c
+++ b/sys/kern/kern_timeout.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_timeout.c,v 1.28 2008/07/14 15:17:08 art Exp $ */
+/* $OpenBSD: kern_timeout.c,v 1.29 2008/10/22 08:38:06 blambert Exp $ */
/*
* Copyright (c) 2001 Thomas Nordin <nordin@openbsd.org>
* Copyright (c) 2000-2001 Artur Grabowski <art@openbsd.org>
@@ -233,6 +233,18 @@ timeout_add_sec(struct timeout *to, int secs)
}
void
+timeout_add_msec(struct timeout *to, int msecs)
+{
+ long long to_ticks;
+
+ to_ticks = (long long)msecs * 1000 / tick;
+ if (to_ticks > INT_MAX)
+ to_ticks = INT_MAX;
+
+ timeout_add(to, (int)to_ticks);
+}
+
+void
timeout_add_usec(struct timeout *to, int usecs)
{
int to_ticks = usecs / tick;
diff --git a/sys/sys/timeout.h b/sys/sys/timeout.h
index 283cf365119..8350029fcdb 100644
--- a/sys/sys/timeout.h
+++ b/sys/sys/timeout.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: timeout.h,v 1.17 2008/07/11 14:18:39 blambert Exp $ */
+/* $OpenBSD: timeout.h,v 1.18 2008/10/22 08:38:06 blambert Exp $ */
/*
* Copyright (c) 2000-2001 Artur Grabowski <art@openbsd.org>
* All rights reserved.
@@ -87,6 +87,7 @@ void timeout_add_tv(struct timeout *, struct timeval *);
void timeout_add_ts(struct timeout *, struct timespec *);
void timeout_add_bt(struct timeout *, struct bintime *);
void timeout_add_sec(struct timeout *, int);
+void timeout_add_msec(struct timeout *, int);
void timeout_add_usec(struct timeout *, int);
void timeout_add_nsec(struct timeout *, int);
void timeout_del(struct timeout *);