A slightly different version of that is called a spin lock and is used in multi-threaded applications, and it can be faster than other types of locks, but you have to be careful because there can be things that go wrong.
Another useful difference to note between a genuine wait function such as "sleep()" or "Sleep()" and the ad-hoc function you have here, is that with a real wait function the thread will respond to system messages in a timely manner. This was already eluded to, when people mentioned the use of clock cycles and such, but I wanted to emphasis it I guess.
Please remember that timers are a secondary control mechanism; and are of very little use otherwise. You have mutexe's, critical sections, object signal states and a half dozen or more other tools depending on which librar(y\ies) you are using. Even in cases like the first thread that JLBorges linked to where the OP had wanted to accomplish something based on the time of day, custom timers are NOT how you would go about doing this. I know that the contributors were answering the OP's question in the way that it was framed, but Windows Task Scheduler would have been the correct solution for running a daily task.