1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <sys/time.h> 4 5 #include "timer.h" 6 7 int main(int argc, char **argv) 8 { 9 struct timer *tp; 10 tp = new_timer(10); 11 12 sleep(5); 13 14 if(tp->expired(tp)) { 15 printf("timer should not have expired\n"); 16 exit(-1); 17 } 18 19 sleep(5); 20 21 if(!tp->expired(tp)) { 22 printf("timer should have expired\n"); 23 exit(-2); 24 } 25 26 exit(0); 27 } 28