changed get_timeofday() to clock_gettime()