Busy-wait sleep function has incorrect timing on NIOS CPU
I had the same problem and got the same result. For 1 second I had about real 2 s pause. The reason is that it is realized by software cycle, I guess. At least, here is the comment from Intel FPGA (prev. Altera) https://www.intel.com/content/www/us/en/programmable/support/support-resources/knowledge-base/solutions/rd08312011_772.html

You can resolve your need of good timing count by using ticks counting something like that:

#include &lt;sys/alt_alarm.h&gt;
...
//somewhere in your program
void function_t(){
int prev= 0;
int now;
now = (int) (alt_nticks() * alt_ticks_per_second() / 1000);
if ((now - prev) &lt; period)
return;
last = now;
//my action
}


so I used such function in my round-robin code to do something with using timer.
But if you are really want to use timer precisely, you should use interrupts.