I have an application that calls gettimeofday
to store the tv_sec in which that part of the code starts to run. This code is very simple:
struct timeval tvnow;
gettimeofday(&tvnow);
int initialTime = tvnow.tv_sec;
It normally works fine but sometimes I am getting unexpected results such as
tvnow = {tv_sec = 1024, tv_usec = 0}
initialTime = 1401591
Or
tvnow = {tv_sec = 1024, tv_usec = 0}
initialTime = 2439903
Why could this happen?
Regards