diff options
| author | Bruce Evans <bde@FreeBSD.org> | 2002-10-01 08:00:41 +0000 |
|---|---|---|
| committer | Bruce Evans <bde@FreeBSD.org> | 2002-10-01 08:00:41 +0000 |
| commit | 1dc8e58608ee93b99d63563020bbdd66360aaf88 (patch) | |
| tree | 72bdf4c5f1f4f7a81d63f4f88875822e0d72bac5 /sys/kern/kern_time.c | |
| parent | 7d32c7e4a6853218c553a471f104c32c3ef444bb (diff) | |
Notes
Diffstat (limited to 'sys/kern/kern_time.c')
| -rw-r--r-- | sys/kern/kern_time.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c index 7c06c50da828..d32579033501 100644 --- a/sys/kern/kern_time.c +++ b/sys/kern/kern_time.c @@ -209,7 +209,12 @@ clock_getres(p, uap) error = 0; if (SCARG(uap, tp)) { ts.tv_sec = 0; - ts.tv_nsec = 1000000000 / timecounter->tc_frequency; + /* + * Round up the result of the division cheaply by adding 1. + * Rounding up is especially important if rounding down + * would give 0. Perfect rounding is unimportant. + */ + ts.tv_nsec = 1000000000 / timecounter->tc_frequency + 1; error = copyout(&ts, SCARG(uap, tp), sizeof(ts)); } return (error); |
