Skip to content

Commit

Permalink
Merge pull request wjwwood#116 from pao/patch-1
Browse files Browse the repository at this point in the history
Use CLOCK_MONOTONIC (Linux)/SYSTEM_CLOCK (OS X) to time select()
  • Loading branch information
wjwwood committed Nov 10, 2015
2 parents ef7f77d + c5b4bbd commit e12d81e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/impl/unix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@ MillisecondTimer::timespec_now ()
# ifdef __MACH__ // OS X does not have clock_gettime, use clock_get_time
clock_serv_t cclock;
mach_timespec_t mts;
host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock);
host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &cclock);
clock_get_time(cclock, &mts);
mach_port_deallocate(mach_task_self(), cclock);
time.tv_sec = mts.tv_sec;
time.tv_nsec = mts.tv_nsec;
# else
clock_gettime(CLOCK_REALTIME, &time);
clock_gettime(CLOCK_MONOTONIC, &time);
# endif
return time;
}
Expand Down

0 comments on commit e12d81e

Please sign in to comment.