Lines Matching +full:conversion +full:- +full:interval

4  * - clock driver for hopf serial boards (GPS or DCF77)
53 #define PRECISION (-10) /* precision assumed (about 1 ms) */
111 * hopfserial_start - open the devices and initialize data for processing
129 fd = refclock_open(&peer->srcadr, gpsdev, SPEED232, LDISC_CLK);
144 pp = peer->procptr;
145 pp->unitptr = up;
146 pp->io.clock_recv = hopfserial_receive;
147 pp->io.srcclock = peer;
148 pp->io.datalen = 0;
149 pp->io.fd = fd;
150 if (!io_addclock(&pp->io)) {
155 pp->io.fd = -1;
157 pp->unitptr = NULL;
164 pp->clockdesc = DESCRIPTION;
165 peer->precision = PRECISION;
166 memcpy((char *)&pp->refid, REFID, 4);
168 up->leap_status = 0;
169 up->unit = (short) unit;
176 * hopfserial_shutdown - shut down the clock
187 pp = peer->procptr;
188 up = pp->unitptr;
190 if (-1 != pp->io.fd)
191 io_closeclock(&pp->io);
199 * hopfserial_receive - receive data from the serial interface
214 int day, month; /* ddd conversion */
220 peer = rbufp->recv_peer;
221 pp = peer->procptr;
222 up = pp->unitptr;
224 if (up->rpt_next == 0 )
227 up->rpt_next = 0; /* wait until next poll interval occur */
229 pp->lencode = (u_short)refclock_gtlin(rbufp, pp->a_lastcode,
230 sizeof(pp->a_lastcode),
231 &pp->lastrec);
232 if (pp->lencode == 0)
235 converted = sscanf(pp->a_lastcode,
243 &pp->hour,
244 &pp->minute,
245 &pp->second,
248 &pp->year);
253 array-bounds problems, etc.
255 if ((8 != converted) || (pp->hour < 0) || (pp->hour > 23) ||
256 (pp->minute < 0) || (pp->minute > 59) || (pp->second < 0) ||
257 (pp->second > 60) /*Allow for leap seconds.*/ ||
260 (pp->year < 0) || (pp->year > 99)) {
268 pp->day = ymd2yd(pp->year,month,day);
269 pp->leap=0;
271 /* Year-2000 check! */
272 /* wrap 2-digit date into 4-digit */
274 if(pp->year < YEAR_PIVOT) { pp->year += 100; } /* < 98 */
275 pp->year += 1900;
280 snprintf(pp->a_lastcode, sizeof(pp->a_lastcode),
286 pp->year,
287 pp->hour,
288 pp->minute,
289 pp->second);
291 pp->lencode = strlen(pp->a_lastcode);
294 pp->leap = LEAP_NOTINSYNC;
303 pp->leap = LEAP_NOTINSYNC;
313 if ((pp->sloppyclockflag & CLK_FLAG1) == 0) {
315 pp->leap = LEAP_NOTINSYNC;
325 pp->lastref = pp->lastrec;
329 msyslog(LOG_ERR, " D:%x D:%d D:%d",synch,pp->minute,pp->second);
332 record_clock_stats(&peer->srcadr, pp->a_lastcode);
339 * hopfserial_poll - called by the transmit procedure
350 pp = peer->procptr;
352 up = pp->unitptr;
354 pp->polls++;
355 up->rpt_next = 1;
358 record_clock_stats(&peer->srcadr, pp->a_lastcode);