Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
The problem might be in clock(), which just reads the rather slowly ticking time-of-day clock of your PC. You cannot use clock() to check if msleep() is OK.
Note that CLOCKS_PER_SEC is not the final answer; I have seen Linux systems where it was 1000 (or was it a million), but the increments were far greater than one. So it only describes the units used by the return value of clock(), not how frequently it actually ticks. In other words, it specifies precision rather than accuracy.
On Windows you can use GetTickCount() to get a time with msec accuracy.
Here's what I use in Wasp for both Windows and Linux. Reset != 0 starts the timer and reset == 0 returns the elapsed time in seconds (floating point). I think its accurate to well under a millisecond.
auto t0 = high_resolution_clock::now();
// do something in between
auto t1 = high_resolution_clock::now();
auto delta_t = duration_cast<duration<double>>(t1 - t0).count();