FreeBSD/contrib/ntp/ntpd/refclock_wwv.c
/*
 * wwv_newgame - reset and start over
 *
 * There are three conditions resulting in a new game:
 *
 * 1	After finding the minute pulse (MSYNC lit), going 15 minutes
 *	(DATA) without finding the unit seconds digit.
 *
 * 2	After finding good data (DSYNC lit), going more than 40 minutes
 *	(SYNCH) without finding station sync (INSYNC lit).
 *
 * 3	After finding station sync (INSYNC lit), going more than 2 days
 *	(PANIC) without finding any station. 
 */
reset and start over
There are three conditions resulting in a new game.

1    After finding the minute pulse (MSYNC lit), going 15 minutes
(DATA) without finding the unit seconds digit.

2    After finding good data (DSYNC lit), going more than 40 minutes
(SYNCH) without finding station sync (INSYNC lit).

3    After finding station sync (INSYNC lit), going more than 2 days
(PANIC) without finding any station.
reset and start over There are three conditions resulting in a new game . 1 After finding the minute pulse ( MSYNC lit ) going 15 minutes ( DATA ) without finding the unit seconds digit . 2 After finding good data ( DSYNC lit ) going more than 40 minutes ( SYNCH ) without finding station sync ( INSYNC lit ) . 3 After finding station sync ( INSYNC lit ) going more than 2 days ( PANIC ) without finding any station .
static void
wwv_newgame(
	struct peer *peer	
	)
{
	struct refclockproc *pp;
	struct wwvunit *up;
	struct chan *cp;
	int i;
	pp = peer->procptr;
	up = pp->unitptr;
	if (up->status)
		up->errflg = CEVNT_TIMEOUT;
	peer->leap = LEAP_NOTINSYNC;
	up->watch = up->status = up->alarm = 0;
	up->avgint = MINAVG;
	up->freq = 0;
	up->gain = MAXGAIN / 2;
	memset(up->mitig, 0, sizeof(up->mitig));
	for (i = 0; i < NCHAN; i++) {
		cp = &up->mitig[i];
		cp->gain = up->gain;
		cp->wwv.select = SELV;
		snprintf(cp->wwv.refid, sizeof(cp->wwv.refid), "WV%.0f",
		    floor(qsy[i])); 
		cp->wwvh.select = SELH;
		snprintf(cp->wwvh.refid, sizeof(cp->wwvh.refid), "WH%.0f",
		    floor(qsy[i])); 
	}
	up->dchan = (DCHAN + NCHAN - 1) % NCHAN;
	wwv_newchan(peer);
	up->schan = up->dchan;
}
static void wwv_newgame ( struct peer * peer ) { struct refclockproc * pp ; struct wwvunit * up ; struct chan * cp ; int i ; pp = peer -> procptr ; up = pp -> unitptr ; if ( up -> status ) up -> errflg = CEVNT_TIMEOUT ; peer -> leap = LEAP_NOTINSYNC ; up -> watch = up -> status = up -> alarm = 0 ; up -> avgint = MINAVG ; up -> freq = 0 ; up -> gain = MAXGAIN / 2 ; memset ( up -> mitig , 0 , sizeof ( up -> mitig ) ) ; for ( i = 0 ; i < NCHAN ; i ++ ) { cp = & up -> mitig [ i ] ; cp -> gain = up -> gain ; cp -> wwv . select = SELV ; snprintf ( cp -> wwv . refid , sizeof ( cp -> wwv . refid ) , " " , floor ( qsy [ i ] ) ) ; cp -> wwvh . select = SELH ; snprintf ( cp -> wwvh . refid , sizeof ( cp -> wwvh . refid ) , " " , floor ( qsy [ i ] ) ) ; } up -> dchan = ( DCHAN + NCHAN - 1 ) % NCHAN ; wwv_newchan ( peer ) ; up -> schan = up -> dchan ; }
wwv_newgame - reset and start over
 There are three conditions resulting in a new game:
wwv_newgame - reset and start over There are three conditions resulting in a new game :
/* peer structure pointer */ /*
	 * Initialize strategic values. Note we set the leap bits
	 * NOTINSYNC and the refid "NONE".
	 */ /*
	 * Initialize the station processes for audio gain, select bit,
	 * station/frequency identifier and reference identifier. Start
	 * probing at the strongest channel or the default channel if
	 * nothing heard.
	 */