Change unix clock to realtime

This commit is contained in:
Pavel Krajcevski 2012-08-31 18:05:29 -04:00
parent 278a59e24a
commit f2b9c39801

View file

@ -35,12 +35,12 @@ StopWatch::StopWatch() : impl(new StopWatchImpl) {
}
void StopWatch::Start() {
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &(impl->ts));
clock_gettime(CLOCK_REALTIME, &(impl->ts));
impl->timer = double(impl->ts.tv_sec) + 1e-9 * double(impl->ts.tv_nsec);
}
void StopWatch::Stop() {
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &(impl->ts));
clock_gettime(CLOCK_REALTIME, &(impl->ts));
impl->duration = -(impl->timer) + (double(impl->ts.tv_sec) + 1e-9 * double(impl->ts.tv_nsec));
}