On 2015-01-13, Theo de Raadt <[email protected]> wrote:

>> > Hmm, I guess we could skip the compatibility handling completely
>> > and just let ntpd re-discover the drift.
>> 
>> Heh.  Sounds plausible.
>
> Smaller diff.

I started with 2.679024e-05 in ntpd.drift and pretty soon got this:
adjusting clock frequency by 25.510055 to 25.510082ppm

Here's the small diff:

Index: ntpd.c
===================================================================
RCS file: /cvs/src/usr.sbin/ntpd/ntpd.c,v
retrieving revision 1.84
diff -u -p -r1.84 ntpd.c
--- ntpd.c      13 Jan 2015 02:28:56 -0000      1.84
+++ ntpd.c      13 Jan 2015 20:57:13 -0000
@@ -494,9 +494,10 @@ readfreq(void)
        if (adjfreq(NULL, &current) == -1)
                log_warn("adjfreq failed");
        else if (current == 0) {
-               if (fscanf(fp, "%le", &d) == 1)
+               if (fscanf(fp, "%lf", &d) == 1) {
+                       d /= 1e6;       /* scale from ppm */
                        ntpd_adjfreq(d, 0);
-               else
+               } else
                        log_warnx("can't read %s", DRIFTFILE);
        }
        fclose(fp);
@@ -518,7 +519,7 @@ writefreq(double d)
                return 0;
        }
 
-       fprintf(fp, "%e\n", d);
+       fprintf(fp, "%.3f\n", d * 1e6);         /* scale to ppm */
        r = ferror(fp);
        if (fclose(fp) != 0 || r != 0) {
                if (warnonce) {
-- 
Christian "naddy" Weisgerber                          [email protected]

Reply via email to