time_t seconds;

seconds = time(NULL);
long secondsToCountTo = seconds + 30;

while (seconds <= secondsToCountTo)
{
doStuff();
}


I *think* this will work.. if not you can look up functions in time.h yourself.