When doing microcontroller programming, you should always use the on-chip hardware timers if possible. There are typically several of those and perhaps a real-time clock as well. Rather than looking for some busy-delay function, you should look for a driver or HAL around those hardware timers present in your MCU.
In addition, if you need better than 1ms resolution then note that "delay" functions tend to be inaccurate.
Busy-delay() functions/loops are mostly a quick & dirty amateur solution. They are bad because:
- They consume 100% CPU and thereby 100% power.
- They have a tight coupling against the compiler and its settings. Different optimization levels might break such delays.
- They have a tight coupling to the system clock, whereas on-chip timer drivers usually specify which clock to use as a parameter and adjust pre-scaling accordingly.
- They are typically not very accurate.
- Overall they do not necessarily have deterministic behavior.