If this is on windows... code like that will race and eventually overheat the CPU as well as crippling multitasking... the windows function Sleep() is generally used to allow time sharing and other routines to run. You don't need to monitor tmp on a nanosecond basis... twice per second should be close enough...
Code:
#include <windows.h>
do
{ time(&tmp);
Sleep(500); }
while (tmp != timedata);
... will probably result in a small fraction of a percent of CPU usage.
Linux has similar functions, but I'm not very familiar with them... Same on Mac.