Lines Matching +full:write +full:- +full:1 +full:- +full:bps
2 * refclock_chronolog - clock driver for Chronolog K-series WWVB receiver.
26 * This driver supports the Chronolog K-series WWVB receiver.
33 * YY/MM/DD -- what you'd expect. This arrives a few seconds before the
35 * hh:mm:ss -- what you'd expect. We take time on the <cr>.
37 * Our Chronolog writes time out at 2400 bps 8/N/1, but it can be configured
49 #define PRECISION (-13) /* precision assumed (about 100 us) */
51 #define DESCRIPTION "Chrono-log K" /* WRU */
56 * Chrono-log unit control structure
62 int year; /* Y2K-adjusted year */
63 int day; /* day-of-month */
64 int month; /* month-of-year */
81 chronolog_poll, /* poll the driver -- a nice fabrication */
90 * chronolog_start - open the devices and initialize data for processing
112 fd = refclock_open(&peer->srcadr, device, SPEED232, 0);
120 pp = peer->procptr;
121 pp->unitptr = up;
122 pp->io.clock_recv = chronolog_receive;
123 pp->io.srcclock = peer;
124 pp->io.datalen = 0;
125 pp->io.fd = fd;
126 if (!io_addclock(&pp->io)) {
128 pp->io.fd = -1;
130 pp->unitptr = NULL;
137 peer->precision = PRECISION;
138 pp->clockdesc = DESCRIPTION;
139 memcpy((char *)&pp->refid, REFID, 4);
140 return (1);
145 * chronolog_shutdown - shut down the clock
156 pp = peer->procptr;
157 up = pp->unitptr;
158 if (-1 != pp->io.fd)
159 io_closeclock(&pp->io);
166 * chronolog_receive - receive data from the serial interface
178 int hours; /* hour-of-day */
179 int minutes; /* minutes-past-the-hour */
187 peer = rbufp->recv_peer;
188 pp = peer->procptr;
189 up = pp->unitptr;
190 temp = refclock_gtlin(rbufp, pp->a_lastcode, BMAX, &trtmp);
193 if (up->tcswitch == 0) {
194 up->tcswitch = 1;
195 up->laststamp = trtmp;
197 up->tcswitch = 0;
200 pp->lencode = temp;
201 pp->lastrec = up->laststamp;
202 up->laststamp = trtmp;
203 up->tcswitch = 1;
207 printf("chronolog: timecode %d %s\n", pp->lencode,
208 pp->a_lastcode);
219 if (sscanf(pp->a_lastcode, "Y %d/%d/%d", &up->year,&up->month,&up->day))
222 * Y2K convert the 2-digit year
224 up->year = up->year >= 69 ? up->year : up->year + 100;
227 if (sscanf(pp->a_lastcode,"Z %02d:%02d:%02d",
239 * means we have to do Y2K conversion on the 2-digit year;
245 local.tm_year = up->year;
246 local.tm_mon = up->month-1;
247 local.tm_mday = up->day;
251 local.tm_isdst = -1;
259 adjyear = gmtp->tm_year+1900;
260 adjmon = gmtp->tm_mon+1;
261 pp->day = ymd2yd (adjyear, adjmon, gmtp->tm_mday);
262 pp->hour = gmtp->tm_hour;
263 pp->minute = gmtp->tm_min;
264 pp->second = gmtp->tm_sec;
268 adjyear,adjmon,gmtp->tm_mday,pp->hour,pp->minute,
269 pp->second);
276 pp->day = ymd2yd(year+1900,month,day);
277 pp->hour = hours;
278 pp->minute = minutes;
279 pp->second = seconds;
282 got_good=1;
297 pp->lastref = pp->lastrec;
299 record_clock_stats(&peer->srcadr, pp->a_lastcode);
300 up->lasthour = (u_char)pp->hour;
305 * chronolog_poll - called by the transmit procedure
314 * Time to poll the clock. The Chrono-log clock is supposed to
317 * an installation-specific problem. This code is dyked out,
318 * but may be re-enabled if anyone ever finds a Chrono-log that
326 pp = peer->procptr;
327 up = pp->unitptr;
328 if (peer->burst == 0 && peer->reach == 0)
330 if (up->linect > 0)
334 if (write(pp->io.fd, &pollchar, 1) != 1)
337 pp->polls++;