imported tick-sched.c from faux123