I have to run a loop for certain amount of time. I know the following way to do that.
get start time;
while(1)
{
getcurrenttime;
if(start time + time to run >= current time)
break;
else
do what ever you want.
}
Is it ok ? or any other better way to do this?