C Incorrect time

On my system some API functions seem to have problems with time tracking. My system is FreeBSD 10.3 running on hyper-v server 2012.

Calling alarm(20) results in SIGALRM after 11 seconds and sleep(15) returns after 5 seconds.

The behavior of sigtimedwait() is as expected, when no signal is received, -1 is returned with errno = EAGAIN exactly after the given timeout. Also the date command in a terminal shows the correct date and time.

Is there any way to correct these time errors?

Thanks in advance
 
Not sure if it's going to help but for virtual machines it's usually helpful to add to /boot/loader.conf:
Code:
kern.hz=100
This usually helps with timing issues.
 
I added kern.hz=100 and it helped. The described problems are solved. Thank you very much for your help.
 
Back
Top