Change API from time to clock_gettime