replace gettimeofday with clock_gettime