void mch_delay(int32_t msec) { /* * We busy-wait here. Unfortunately, delay() and usleep() have been * reported to give problems with the original Windows 95. This is * fixed in service pack 1, but not everybody installed that. */ long starttime = biostime(0, 0L); while(biostime(0, 0L) < starttime + msec / BIOSTICK); }
globle double gentime() { #if MAC UnsignedWide result; Microseconds(&result); return(((((double) result.hi) * kTwoPower32) + result.lo) / 1000000.0); #endif #if IBM_MCW unsigned long int result; result = GetTickCount(); return((double) result / 1000.0); #endif #if IBM_TBC && (! WINDOW_INTERFACE) unsigned long int result; result = biostime(0,(long int) 0); return((double) result / 18.2); #endif #if GENERIC || (! MAC) return((double) clock() / (double) CLOCKS_PER_SEC); #endif }
/* * Return time since epoch */ time_t getsecs(void) { u_int8_t timebuf[4], datebuf[4]; /* Query BIOS for time & date */ if (!biostime(timebuf) && !biosdate(datebuf)) { #ifdef notdef int dst; dst = timebuf[3]; #endif /* Convert to seconds since Epoch */ return compute(datebuf[0] * 100 + datebuf[1], datebuf[2], datebuf[3], timebuf[0], timebuf[1], timebuf[2]); } else errno = EIO; return 1; }