Hello, can someone tell me how to implement a wait function for a particular period of time (e.g., 5 secs)?

In the program I'm writing, I'm controlling a piece of equipment that has a reset command which must be followed by a run command after the equipment has rebooted. Consequently, I must do the following:

{
//Reset the module
api_reset_module();

//Need to wait for 5 secs
for (i=0;i<20000;i++)
dummyvariable++;

//Now restart the module
api_restart_module();

}

Currently, I just have a for loop stuck in there at a loop count that effectively gets me ~> 5 sec delay but this is not very elegant I know!

Can someone tell me if there is a way to implement a specific delay in a more elegant way?

Thanks

The Newb