diff options
author | 2013-06-03 16:55:21 +0000 | |
---|---|---|
committer | 2013-06-03 16:55:21 +0000 | |
commit | 08be1c182fbd154e4a9fe23d2f7954d0b00a3b1d (patch) | |
tree | c4804a28a8f9e84c1f24ccefb4fe9d4d7f61f5e6 /sys/kern/kern_time.c | |
parent | Implement support for multiple addresses per interface. (diff) | |
download | wireguard-openbsd-08be1c182fbd154e4a9fe23d2f7954d0b00a3b1d.tar.xz wireguard-openbsd-08be1c182fbd154e4a9fe23d2f7954d0b00a3b1d.zip |
Convert some internal APIs to use timespecs instead of timevals
ok matthew@ deraadt@
Diffstat (limited to 'sys/kern/kern_time.c')
-rw-r--r-- | sys/kern/kern_time.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c index fec84fbf5b4..dcb878639fd 100644 --- a/sys/kern/kern_time.c +++ b/sys/kern/kern_time.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_time.c,v 1.78 2013/06/02 20:59:09 guenther Exp $ */ +/* $OpenBSD: kern_time.c,v 1.79 2013/06/03 16:55:22 guenther Exp $ */ /* $NetBSD: kern_time.c,v 1.20 1996/02/18 11:57:06 fvdl Exp $ */ /* @@ -112,8 +112,6 @@ settime(struct timespec *ts) int clock_gettime(struct proc *p, clockid_t clock_id, struct timespec *tp) { - struct timeval tv; - switch (clock_id) { case CLOCK_REALTIME: nanotime(tp); @@ -122,11 +120,9 @@ clock_gettime(struct proc *p, clockid_t clock_id, struct timespec *tp) nanouptime(tp); break; case CLOCK_PROF: - microuptime(&tv); - timersub(&tv, &curcpu()->ci_schedstate.spc_runtime, &tv); - timeradd(&tv, &p->p_rtime, &tv); - tp->tv_sec = tv.tv_sec; - tp->tv_nsec = tv.tv_usec * 1000; + nanouptime(tp); + timespecsub(tp, &curcpu()->ci_schedstate.spc_runtime, tp); + timespecadd(tp, &p->p_rtime, tp); break; default: return (EINVAL); |