I am calculating time elapsed in milli seconds for each successive call to handler function using the code below. When i use usleep(1000) i.e. 1 ms time difference between each
Remember that the tv_usec field of the timeval structure never goes to (or over) one million, instead the number of seconds is increased.
tv_usec
timeval
You have to use the tv_sec field as well in your calculation.
tv_sec