/* * atom_timer - called once per second */ void atom_timer( int unit, /* unit pointer (not used) */ struct peer *peer /* peer structure pointer */ ) { struct ppsunit *up; struct refclockproc *pp; char tbuf[80]; pp = peer->procptr; up = pp->unitptr; if (refclock_pps(peer, &up->atom, pp->sloppyclockflag) <= 0) return; peer->flags |= FLAG_PPS; /* * If flag4 is lit, record each second offset to clockstats. * That's so we can make awesome Allan deviation plots. */ if (pp->sloppyclockflag & CLK_FLAG4) { snprintf(tbuf, sizeof(tbuf), "%.9f", pp->filter[pp->coderecv]); record_clock_stats(&peer->srcadr, tbuf); } }
/* * atom_timer - called once per second */ void atom_timer( int unit, /* unit pointer (not used) */ struct peer *peer /* peer structure pointer */ ) { struct ppsunit *up; struct refclockproc *pp; pps_status rc; UNUSED_ARG(unit); pp = peer->procptr; up = pp->unitptr; rc = refclock_pps(peer, &up->atom, pp->sloppyclockflag); switch (rc) { case PPS_OK: up->pcount++; break; default: case PPS_SETUP: up->scount++; break; case PPS_KERNEL: up->kcount++; break; case PPS_NREADY: up->rcount++; break; } if (rc != PPS_OK) return; peer->flags |= FLAG_PPS; /* * If flag4 is lit, record each second offset to clockstats. * That's so we can make awesome Allan deviation plots. */ if (pp->sloppyclockflag & CLK_FLAG4) { mprintf_clock_stats(&peer->srcadr, "%.9f", pp->filter[pp->coderecv]); } }
/* * wwvb_timer - called once per second by the transmit procedure */ static void wwvb_timer( int unit, struct peer *peer ) { register struct wwvbunit *up; struct refclockproc *pp; char pollchar; /* character sent to clock */ #ifdef DEBUG l_fp now; #endif /* * Time to poll the clock. The Spectracom clock responds to a * 'T' by returning a timecode in the format(s) specified above. * Note there is no checking on state, since this may not be the * only customer reading the clock. Only one customer need poll * the clock; all others just listen in. */ pp = peer->procptr; up = pp->unitptr; if (up->linect > 0) pollchar = 'R'; else pollchar = 'T'; if (write(pp->io.fd, &pollchar, 1) != 1) refclock_report(peer, CEVNT_FAULT); #ifdef DEBUG get_systime(&now); if (debug) printf("%c poll at %s\n", pollchar, prettydate(&now)); #endif #ifdef HAVE_PPSAPI if (up->ppsapi_lit && refclock_pps(peer, &up->atom, pp->sloppyclockflag) > 0) { up->pcount++, peer->flags |= FLAG_PPS; peer->precision = PPS_PRECISION; } #endif /* HAVE_PPSAPI */ }