The problem might be the while condition. while(time >= time2) time2 is larger than time1, therefore it never enters the loop. try while(time <= time2) But as Arnold suggested, busy waiting is a bad choice. Try to find a more elegant solution. -- Ender EREL