From: Todd C. Miller Date: Tue, 5 Jun 2018 02:00:41 +0000 (-0600) Subject: Fix conversion of usec to nsec; from Scott Cheloha X-Git-Tag: SUDO_1_8_24^2~50 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ec2dae81043709173aede70e71e4392b61dc8ff2;p=sudo Fix conversion of usec to nsec; from Scott Cheloha --- diff --git a/plugins/sudoers/starttime.c b/plugins/sudoers/starttime.c index 277548c89..d5df0ffd7 100644 --- a/plugins/sudoers/starttime.c +++ b/plugins/sudoers/starttime.c @@ -109,16 +109,14 @@ get_starttime(pid_t pid, struct timespec *starttime) if (rc != -1) { #if defined(HAVE_KINFO_PROC_FREEBSD) /* FreeBSD and Dragonfly */ - starttime->tv_sec = ki_proc->ki_start.tv_sec; - starttime->tv_nsec = ki_proc->ki_start.tv_usec / 1000; + TIMEVAL_TO_TIMESPEC(&ki_proc->ki_start, starttime); #elif defined(HAVE_KINFO_PROC_44BSD) /* 4.4BSD and macOS */ - starttime->tv_sec = ki_proc->kp_proc.p_starttime.tv_sec; - starttime->tv_nsec = ki_proc->kp_proc.p_starttime.tv_usec / 1000; + TIMEVAL_TO_TIMESPEC(&ki_proc->kp_proc.p_starttime, starttime); #else /* NetBSD and OpenBSD */ starttime->tv_sec = ki_proc->p_ustart_sec; - starttime->tv_nsec = ki_proc->p_ustart_usec / 1000; + starttime->tv_nsec = ki_proc->p_ustart_usec * 1000; #endif sudo_debug_printf(SUDO_DEBUG_INFO, "%s: start time for %d: { %lld, %ld }", __func__,