libuinet
libuinet copied to clipboard
Getting current time in libuinet. nanotime/microtime always writes tv_sec=1
I am trying to make some changes to congestion control in libuinet. I need to track the current time (or up time). I have tried using the nanotime/microtime and nanouptime/microuptime functions in sys/time.h but the timespec/timeval struct returned always has tv_sec=1. It does not change.
A simple test to replicate this issue would be to add the following lines at the top of the cc_ack_received function in sys/netinet/tcp_input.c:
struct timespec ts;
getnanotime(&ts);
printf("Time= %ld\n", ts.tv_sec);
I tried to trace the function calls in the sys/ folder as well as the uinet_kern_*.c files but I can't figure out why the tv_sec value is always equal to 1.