home *** CD-ROM | disk | FTP | other *** search
- /*
- * timeout.c - Timeout calculation/checking functions.
- *
- * Based on timeout.asm.
- *
- *
- */
-
- extern unsigned long far *realclock; /* PCTCP.C */
- static unsigned long date;
- static char oldhour;
-
- #define MAXTICKS 0x1800b0L
-
- unsigned long
- set_ttimeout(unsigned int ticks)
- {
- return(*realclock + date + ticks);
- }
-
- unsigned long set_timeout(unsigned int seconds)
- {
- return(*realclock + date + (((unsigned long)seconds * 1165L) >> 6));
- }
-
- int
- chk_timeout(unsigned long timeout)
- {
- unsigned long this_time;
- char this_hour;
-
- this_time = *realclock;
- this_hour = (this_time >> 16) & 0xff;
- if(this_hour != oldhour) {
- if(this_hour < oldhour)
- date += MAXTICKS;
- oldhour = this_hour;
- }
- this_time += date;
-
- return(timeout < this_time);
- }
-
-