realtimerexpire: rename a confusing variable. no functional change.

(now_ms -> now_ns as it hold a nano second value)
This commit is contained in:
yamt 2010-12-17 22:08:18 +00:00
parent 112d262cd3
commit 56704cd648
1 changed files with 7 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_time.c,v 1.165 2010/04/08 11:51:13 njoly Exp $ */ /* $NetBSD: kern_time.c,v 1.166 2010/12/17 22:08:18 yamt Exp $ */
/*- /*-
* Copyright (c) 2000, 2004, 2005, 2007, 2008, 2009 The NetBSD Foundation, Inc. * Copyright (c) 2000, 2004, 2005, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@ -61,7 +61,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.165 2010/04/08 11:51:13 njoly Exp $"); __KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.166 2010/12/17 22:08:18 yamt Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/resourcevar.h> #include <sys/resourcevar.h>
@ -974,7 +974,7 @@ timerupcall(struct lwp *l)
void void
realtimerexpire(void *arg) realtimerexpire(void *arg)
{ {
uint64_t last_val, next_val, interval, now_ms; uint64_t last_val, next_val, interval, now_ns;
struct timespec now, next; struct timespec now, next;
struct ptimer *pt; struct ptimer *pt;
int backwards; int backwards;
@ -997,17 +997,17 @@ realtimerexpire(void *arg)
if (!backwards && timespeccmp(&next, &now, >)) { if (!backwards && timespeccmp(&next, &now, >)) {
pt->pt_time.it_value = next; pt->pt_time.it_value = next;
} else { } else {
now_ms = timespec2ns(&now); now_ns = timespec2ns(&now);
last_val = timespec2ns(&pt->pt_time.it_value); last_val = timespec2ns(&pt->pt_time.it_value);
interval = timespec2ns(&pt->pt_time.it_interval); interval = timespec2ns(&pt->pt_time.it_interval);
next_val = now_ms + next_val = now_ns +
(now_ms - last_val + interval - 1) % interval; (now_ns - last_val + interval - 1) % interval;
if (backwards) if (backwards)
next_val += interval; next_val += interval;
else else
pt->pt_overruns += (now_ms - last_val) / interval; pt->pt_overruns += (now_ns - last_val) / interval;
pt->pt_time.it_value.tv_sec = next_val / 1000000000; pt->pt_time.it_value.tv_sec = next_val / 1000000000;
pt->pt_time.it_value.tv_nsec = next_val % 1000000000; pt->pt_time.it_value.tv_nsec = next_val % 1000000000;