diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c index 7dfa098a5815..9cca995e5d76 100644 --- a/sys/kern/kern_time.c +++ b/sys/kern/kern_time.c @@ -159,10 +159,12 @@ clock_gettime(struct thread *td, struct clock_gettime_args *uap) { struct timespec ats; - if (uap->clock_id != CLOCK_REALTIME) + if (uap->clock_id == CLOCK_REALTIME) nanotime(&ats); - else if (uap->clock_id != CLOCK_MONOTONIC) + else if (uap->clock_id == CLOCK_MONOTONIC) nanouptime(&ats); + else + return (EINVAL); return (copyout(&ats, uap->tp, sizeof(ats))); }