diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c index 6df10fa07590..366da9da5007 100644 --- a/sys/kern/kern_time.c +++ b/sys/kern/kern_time.c @@ -247,8 +247,9 @@ kern_clock_gettime(struct thread *td, clockid_t clock_id, struct timespec *ats) critical_enter(); switchtime = PCPU_GET(switchtime); curtime = cpu_ticks(); + runtime = td->td_runtime; critical_exit(); - runtime = cputick2usec(td->td_runtime + curtime - switchtime); + runtime = cputick2usec(runtime + curtime - switchtime); ats->tv_sec = runtime / 1000000; ats->tv_nsec = runtime % 1000000 * 1000; break;