summaryrefslogtreecommitdiff
path: root/sys/dev/usb/udcf.c
diff options
context:
space:
mode:
authorMarc Balmer <mbalmer@cvs.openbsd.org>2006-12-10 14:39:06 +0000
committerMarc Balmer <mbalmer@cvs.openbsd.org>2006-12-10 14:39:06 +0000
commit6ef6f5c54fef271dc064213996f9921fe70eab03 (patch)
tree66cb3559fad1dfb3cdcdfbdfbc0bf29ff48fafa9 /sys/dev/usb/udcf.c
parent752eccafe8a9432074dd5c1a1c07faa0ef2669c1 (diff)
Faster synchronization after an unexpected minute gap.
Only look at the skew value if it is != 0. Remove some dead code.
Diffstat (limited to 'sys/dev/usb/udcf.c')
-rw-r--r--sys/dev/usb/udcf.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/sys/dev/usb/udcf.c b/sys/dev/usb/udcf.c
index 23051269fad..b5c60ddac6e 100644
--- a/sys/dev/usb/udcf.c
+++ b/sys/dev/usb/udcf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: udcf.c,v 1.23 2006/12/06 11:44:53 mbalmer Exp $ */
+/* $OpenBSD: udcf.c,v 1.24 2006/12/10 14:39:05 mbalmer Exp $ */
/*
* Copyright (c) 2006 Marc Balmer <mbalmer@openbsd.org>
@@ -52,8 +52,8 @@ int udcfdebug = 0;
#define DPERIOD1 ((long) 5 * 60) /* degrade OK -> WARN */
#define DPERIOD2 ((long) 15 * 60) /* degrade WARN -> CRIT */
-/* skew tolerance of received time diff vs. measured time diff in percent. */
-#define SKEW_TOLERANCE 5
+/* max. skew of received time diff vs. measured time diff in percent. */
+#define MAX_SKEW 5
#define CLOCK_DCF77 0
#define CLOCK_HBG 1
@@ -513,12 +513,7 @@ udcf_mg_probe(void *xsc)
if (time_second - sc->sc_last_mg < 57) {
DPRINTF(("\nunexpected gap, resync\n"));
- sc->sc_sync = 1;
-#if 0
- timeout_add(&sc->sc_to, t_wait);
- timeout_add(&sc->sc_sl_to, t_wait + t_sl);
- sc->sc_last_mg = 0;
-#endif
+ sc->sc_sync = sc->sc_minute = 1;
goto cleanbits;
}
@@ -579,7 +574,7 @@ udcf_mg_probe(void *xsc)
DPRINTF(("\n%02d.%02d.%04d %02d:%02d:00 %s",
ymdhm.dt_day, ymdhm.dt_mon, ymdhm.dt_year,
ymdhm.dt_hour, ymdhm.dt_min, z1_bit ? "CEST" : "CET"));
- DPRINTF((r_bit ? ", reserve antenna" : ""));
+ DPRINTF((r_bit ? ", call bit" : ""));
DPRINTF((a1_bit ? ", dst chg ann." : ""));
DPRINTF((a2_bit ? ", leap sec ann." : ""));
DPRINTF(("\n"));
@@ -597,7 +592,7 @@ udcf_mg_probe(void *xsc)
DPRINTF(("local = %d, recv = %d, skew = %d\n",
tdiff_local, tdiff_recv, skew));
- if (skew * 100LL / tdiff_local > SKEW_TOLERANCE) {
+ if (skew && skew * 100LL / tdiff_local > MAX_SKEW) {
DPRINTF(("skew out of tolerated range\n"));
goto cleanbits;
} else {
@@ -654,7 +649,7 @@ udcf_it_probe(void *xsc)
if (sc->sc_dying)
return;
- DPRINTF(("\ndegrading sensor state"));
+ DPRINTF(("\ndegrading sensor state\n"));
if (sc->sc_sensor.status == SENSOR_S_OK) {
sc->sc_sensor.status = SENSOR_S_WARN;