Lines Matching +full:tv +full:- +full:set
2 * chutest - test the CHU clock
61 int dofilter = 0; /* set to 1 when we should run filter algorithm */
62 int showtimes = 0; /* set to 1 when we should show char arrival times */
63 int doprocess = 0; /* set to 1 when we do processing analogous to driver */
65 int usechuldisc = 0; /* set to 1 when CHU line discipline should be used */
68 int usechuldisc = 0; /* set to 1 when CHU line discipline should be used */
79 void raw_filter(unsigned int c, struct timeval *tv);
84 * main - parse arguments and handle options
133 (void) fprintf(stderr, "usage: %s [-dft] tty_device\n", in main()
137 (void) fprintf(stderr, "usage: %s [-dft] tty_device\n", in main()
142 (void) fprintf(stderr, "usage: %s [-cdft] tty_device\n", in main()
168 * openterm - open a port to the CHU clock
236 * process_raw - process characters in raw mode
245 struct timeval tv; in process_raw() local
249 (void) gettimeofday(&tv, (struct timezone *)0); in process_raw()
251 raw_filter((unsigned int)c, &tv); in process_raw()
253 difftv.tv_sec = tv.tv_sec - lasttv.tv_sec; in process_raw()
254 difftv.tv_usec = tv.tv_usec - lasttv.tv_usec; in process_raw()
256 difftv.tv_sec--; in process_raw()
260 c, tv.tv_sec, tv.tv_usec, difftv.tv_sec, in process_raw()
262 lasttv = tv; in process_raw()
275 * raw_filter - run the line discipline filter over raw data
280 struct timeval *tv in raw_filter() argument
296 diff.tv_sec = tv->tv_sec in raw_filter()
297 - chudata.codetimes[chudata.ncodechars].tv_sec; in raw_filter()
298 diff.tv_usec = tv->tv_usec in raw_filter()
299 - chudata.codetimes[chudata.ncodechars].tv_usec; in raw_filter()
301 diff.tv_sec--; in raw_filter()
314 chudata.codetimes[chudata.ncodechars] = *tv; in raw_filter()
319 TVTOTS(&chudata.codetimes[NCHUCHARS-1], &ts); in raw_filter()
321 chufilter(&chudata, &chudata.codetimes[NCHUCHARS-1]); in raw_filter()
341 * process_ldisc - process line discipline
363 TVTOTS(&chu.codetimes[NCHUCHARS-1], &ts); in process_ldisc()
372 - chu.codetimes[i-1].tv_sec; in process_ldisc()
374 - chu.codetimes[i-1].tv_usec; in process_ldisc()
376 diff.tv_sec--; in process_ldisc()
397 * error - print an error message
423 * is set to 290 ms and we compute delays which are at least 10 ms long.
440 #define CHUPRECISION (-9) /* what the heck */
453 #define MULBY60(x) (((x)<<6) - ((x)<<2)) /* watch overflow */
466 * character after the on-time second and is computed as follows:
491 * Keep the fudge factors separately so they can be set even
512 * init_chu - initialize internal chu driver data
561 printf("%c%c", (chuc->codechars[i] & 0xf) + '0', in chufilter()
562 ((chuc->codechars[i]>>4) & 0xf) + '0'); in chufilter()
569 if (chuc->codechars[i] != chuc->codechars[i+(NCHUCHARS/2)]) { in chufilter()
581 *code++ = chuc->codechars[i] & 0xf; in chufilter()
582 *code++ = (chuc->codechars[i] >> 4) & 0xf; in chufilter()
623 tmp = (u_long)(MULBY24((day-1)) + hour); /* hours */ in chufilter()
636 if (date_ui < (rtime->l_ui + CLOCK_WAYTOOBIG) in chufilter()
637 && date_ui > (rtime->l_ui - CLOCK_WAYTOOBIG)) in chufilter()
644 date_ui = calyearstart(rtime->l_ui, NULL); in chufilter()
649 date_ui, rtime->l_ui, (long)date_ui-(long)rtime->l_ui); in chufilter()
650 if (date_ui < (rtime->l_ui + CLOCK_WAYTOOBIG) in chufilter()
651 && date_ui > (rtime->l_ui - CLOCK_WAYTOOBIG)) in chufilter()
669 if ((rtime->l_ui - yearstart) < CLOCK_WAYTOOBIG) { in chufilter()
671 date_ui += calyearstart(yearstart - CLOCK_WAYTOOBIG, in chufilter()
673 if ((rtime->l_ui - date_ui) < CLOCK_WAYTOOBIG) in chufilter()
685 if ((date_ui - rtime->l_ui) >= CLOCK_WAYTOOBIG) { in chufilter()
702 tmp = chuc->codetimes[i].tv_sec + JAN_1970; in chufilter()
703 TVUTOTSF(chuc->codetimes[i].tv_usec, tmp2); in chufilter()
733 * Here is a multiply-by-0.1 optimization that should apply in chufilter()