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...
... will probably result in a small fraction of a percent of CPU usage.
while (tmp != timedata);
Linux has similar functions, but I'm not very familiar with them... Same on Mac.