Example #1
0
uint64_t ClockPosix::now()
{
#if defined(HAVE_POSIX_TIMERS)
  struct timespec ts;
#if defined(HAVE_PTHREAD_CONDATTR_SETCLOCK)
  clock_gettime(getClockId(), &ts);
#else
  clock_gettime(CLOCK_REALTIME, &ts);
#endif
  return toNSec(ts);
#else
  struct timeval tv;
  gettimeofday(&tv, NULL);
  return toNSec(tv);
#endif
}
Example #2
0
void sleepSec(double t){
	sleep(toNSec(t));
}