Lines Matching +full:sync +full:- +full:2

2  * refclock_ulink - clock driver for Ultralink  WWVB receiver
59 * on the Ultralink model 33X decoder Dip switch 2 controls
62 * dont set fudge flag1 if dip switch 2 is set on model 33x decoder
71 #define PRECISION (-10) /* precision assumed (about 10 ms) */
112 * ulink_start - open the devices and initialize data for processing
129 fd = refclock_open(&peer->srcadr, device, SPEED232, LDISC_CLK);
138 pp = peer->procptr;
139 pp->io.clock_recv = ulink_receive;
140 pp->io.srcclock = peer;
141 pp->io.datalen = 0;
142 pp->io.fd = fd;
143 if (!io_addclock(&pp->io)) {
145 pp->io.fd = -1;
149 pp->unitptr = up;
154 peer->precision = PRECISION;
155 pp->clockdesc = DESCRIPTION;
156 memcpy((char *)&pp->refid, REFID, 4);
162 * ulink_shutdown - shut down the clock
173 pp = peer->procptr;
174 up = pp->unitptr;
175 if (pp->io.fd != -1)
176 io_closeclock(&pp->io);
183 * ulink_receive - receive data from the serial interface
201 char char_quality[2]; /* temp quality flag */
206 peer = rbufp->recv_peer;
207 pp = peer->procptr;
208 up = pp->unitptr;
209 temp = refclock_gtlin(rbufp, pp->a_lastcode, BMAX, &trtmp);
216 if (up->tcswitch == 0) {
217 up->tcswitch = 1;
218 up->laststamp = trtmp;
220 up->tcswitch = 0;
223 pp->lencode = temp;
224 pp->lastrec = up->laststamp;
225 up->laststamp = trtmp;
226 up->tcswitch = 1;
229 printf("ulink: timecode %d %s\n", pp->lencode,
230 pp->a_lastcode);
239 switch (pp->lencode ) {
249 if (sscanf(pp->a_lastcode, "%c%*31c",
260 * R WWVB decodersignal readability R1 - R5
265 * 00 Hours since last good WWVB frame sync. Will
266 * be 00-99
268 * YYYY Current year, 2000-2099
271 * DDD Day of year, 000 - 365.
274 * S - standard time (STD) in effect
275 * O - during STD to DST day 0000-2400
276 * D - daylight savings time (DST) in effect
277 * I - during DST to STD day 0000-2400
279 * HH Hours 00-23
280 * : This is the REAL in sync indicator (: = insync)
281 * MM Minutes 00-59
282 * : : = in sync ? = NOT in sync
283 * SS Seconds 00-59
290 if (sscanf(pp->a_lastcode,
291 "%*2c %*2c%2c%*c%4d%*c%3d%*4c %2d%c%2d:%2d%c%*2c",
292 char_quality, &pp->year, &pp->day,
293 &pp->hour, &syncchar, &pp->minute, &pp->second,
305 if (leapchar == 'D' ) leapchar = '-';
328 * S WWVB decoder sync indicator. S for in-sync(?)
330 * 9+ RF signal level in S-units, 0-9 followed by
333 * D Data bit 0, 1, 2 (position mark), or
336 * 00 Hours since last good WWVB frame sync. Will
337 * be 00-23 hrs, or '1d' to '7d'. Will be 'Lk'
338 * if currently in sync.
340 * YYYY Current year, 1990-2089
343 * DDD Day of year, 001 - 366.
346 * S - standard time (STD) in effect
347 * O - during STD to DST day 0000-2400
348 * D - daylight savings time (DST) in effect
349 * I - during DST to STD day 0000-2400
351 * HH Hours 00-23
352 * : This is the REAL in sync indicator (: = insync)
353 * MM Minutes 00-59
354 * : : = in sync ? = NOT in sync
355 * SS Seconds 00-59
357 * to '+' or '-' during month preceding leap
362 if (sscanf(pp->a_lastcode,
363 "%*4c %2c %4d%*c%3d%*4c %2d%c%2d:%2d%c%*2c",
364 char_quality, &pp->year, &pp->day,
365 &pp->hour, &syncchar, &pp->minute, &pp->second,
403 * S = 'S' -- sync'd in last hour,
404 * '0'-'9' - hours x 10 since last update,
405 * '?' -- not in sync
406 * Q = Number of correlating time-frames, from 0 to 5
407 * R = 'R' -- reception in progress,
408 * 'N' -- Noisy reception,
409 * ' ' -- standby mode
419 * T = DST <-> STD transition indicators
423 if (sscanf(pp->a_lastcode, "%c%1d%c%4d%3d%*c%2d:%2d:%2d.%2ld%c",
424 &syncchar, &quality, &modechar, &pp->year, &pp->day,
425 &pp->hour, &pp->minute, &pp->second,
426 &pp->nsec, &leapchar) == 10) {
427 pp->nsec *= 10000000; /* M320 returns 10's of msecs */
429 if (leapchar == 'D' ) leapchar = '-';
450 * maintain +/-0.002 seconds accuracy when locked to WWVB. This
452 * string. When not in lock, a drift of +/-0.015 seconds should
465 if (pp->lencode == LEN33X) {
468 pp->disp=.002;
471 pp->disp=.02;
473 case 2 :
474 pp->disp=.04;
477 pp->disp=.08;
480 pp->disp=MAXDISPERSE;
486 pp->disp=.002;
489 pp->disp=.02;
492 pp->disp=.04;
494 case 2 :
495 pp->disp=.08;
498 pp->disp=.16;
501 pp->disp=MAXDISPERSE;
514 pp->leap = LEAP_NOTINSYNC;
516 pp->leap = LEAP_ADDSECOND;
517 else if (leapchar == '-')
518 pp->leap = LEAP_DELSECOND;
520 pp->leap = LEAP_NOWARNING;
533 * ulink_poll - called by the transmit procedure
545 pp = peer->procptr;
547 if (pp->sloppyclockflag & CLK_FLAG1) {
548 if (write(pp->io.fd, &pollchar, 1) != 1)
551 pp->polls++;
554 pp->polls++;
556 if (pp->coderecv == pp->codeproc) {
560 pp->lastref = pp->lastrec;
562 record_clock_stats(&peer->srcadr, pp->a_lastcode);