Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Update an outdated comment.



details:   https://anonhg.NetBSD.org/src/rev/d1d7066b5276
branches:  trunk
changeset: 486834:d1d7066b5276
user:      mycroft <mycroft%NetBSD.org@localhost>
date:      Mon May 29 15:05:10 2000 +0000

description:
Update an outdated comment.
Allow all powers of 2 from 2^0 to 2^16 for hz.
Enable hz==1200.

diffstat:

 sys/kern/kern_clock.c |  46 ++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 42 insertions(+), 4 deletions(-)

diffs (78 lines):

diff -r 689a4ab7ecb0 -r d1d7066b5276 sys/kern/kern_clock.c
--- a/sys/kern/kern_clock.c     Mon May 29 14:58:59 2000 +0000
+++ b/sys/kern/kern_clock.c     Mon May 29 15:05:10 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_clock.c,v 1.56 2000/05/29 14:58:59 mycroft Exp $  */
+/*     $NetBSD: kern_clock.c,v 1.57 2000/05/29 15:05:10 mycroft Exp $  */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -398,6 +398,24 @@
 
 #ifdef NTP
        switch (hz) {
+       case 1:
+               shifthz = SHIFT_SCALE - 0;
+               break;
+       case 2:
+               shifthz = SHIFT_SCALE - 1;
+               break;
+       case 4:
+               shifthz = SHIFT_SCALE - 2;
+               break;
+       case 8:
+               shifthz = SHIFT_SCALE - 3;
+               break;
+       case 16:
+               shifthz = SHIFT_SCALE - 4;
+               break;
+       case 32:
+               shifthz = SHIFT_SCALE - 5;
+               break;
        case 60:
        case 64:
                shifthz = SHIFT_SCALE - 6;
@@ -417,6 +435,25 @@
        case 1024:
                shifthz = SHIFT_SCALE - 10;
                break;
+       case 1200:
+       case 2048:
+               shifthz = SHIFT_SCALE - 11;
+               break;
+       case 4096:
+               shifthz = SHIFT_SCALE - 12;
+               break;
+       case 8192:
+               shifthz = SHIFT_SCALE - 13;
+               break;
+       case 16384:
+               shifthz = SHIFT_SCALE - 14;
+               break;
+       case 32768:
+               shifthz = SHIFT_SCALE - 15;
+               break;
+       case 65536:
+               shifthz = SHIFT_SCALE - 16;
+               break;
        default:
                panic("weird hz");
        }
@@ -677,13 +714,14 @@
                 *   obase=2
                 *   idealhz/realhz
                 * where `idealhz' is the next higher power of 2, and `realhz'
-                * is the actual value.
+                * is the actual value.  You may need to factor this result
+                * into a sequence of 2 multipliers to get better precision.
                 *
                 * Likewise, the error can be calculated with (e.g. for 100Hz):
                 *   bc -q
                 *   scale=24
-                *   ((1+2^-2+2^-5)*realhz-idealhz)/idealhz
-                * (and then multiply by 100 to get %).
+                *   ((1+2^-2+2^-5)*(1-2^-10)*realhz-idealhz)/idealhz
+                * (and then multiply by 1000000 to get ppm).
                 */
                switch (hz) {
                case 96:



Home | Main Index | Thread Index | Old Index