use clock_gettime() instead of gettimeofday() to fix the lockups caused by the time jumps. But there are other places left that still use gettimeofday() - to be inspected.