kern_time.c (292777) | kern_time.c (298649) |
---|---|
1/*- 2 * Copyright (c) 1982, 1986, 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 16 unchanged lines hidden (view full) --- 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * @(#)kern_time.c 8.1 (Berkeley) 6/10/93 30 */ 31 32#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1982, 1986, 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 16 unchanged lines hidden (view full) --- 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * @(#)kern_time.c 8.1 (Berkeley) 6/10/93 30 */ 31 32#include <sys/cdefs.h> |
33__FBSDID("$FreeBSD: head/sys/kern/kern_time.c 292777 2015-12-27 15:37:07Z dchagin $"); | 33__FBSDID("$FreeBSD: head/sys/kern/kern_time.c 298649 2016-04-26 15:38:17Z pfg $"); |
34 35#include <sys/param.h> 36#include <sys/systm.h> 37#include <sys/limits.h> 38#include <sys/clock.h> 39#include <sys/lock.h> 40#include <sys/mutex.h> 41#include <sys/sysproto.h> --- 406 unchanged lines hidden (view full) --- 448 * Rounding up is especially important if rounding down 449 * would give 0. Perfect rounding is unimportant. 450 */ 451 ts->tv_nsec = 1000000000 / tc_getfrequency() + 1; 452 break; 453 case CLOCK_VIRTUAL: 454 case CLOCK_PROF: 455 /* Accurately round up here because we can do so cheaply. */ | 34 35#include <sys/param.h> 36#include <sys/systm.h> 37#include <sys/limits.h> 38#include <sys/clock.h> 39#include <sys/lock.h> 40#include <sys/mutex.h> 41#include <sys/sysproto.h> --- 406 unchanged lines hidden (view full) --- 448 * Rounding up is especially important if rounding down 449 * would give 0. Perfect rounding is unimportant. 450 */ 451 ts->tv_nsec = 1000000000 / tc_getfrequency() + 1; 452 break; 453 case CLOCK_VIRTUAL: 454 case CLOCK_PROF: 455 /* Accurately round up here because we can do so cheaply. */ |
456 ts->tv_nsec = (1000000000 + hz - 1) / hz; | 456 ts->tv_nsec = howmany(1000000000, hz); |
457 break; 458 case CLOCK_SECOND: 459 ts->tv_sec = 1; 460 ts->tv_nsec = 0; 461 break; 462 case CLOCK_THREAD_CPUTIME_ID: 463 case CLOCK_PROCESS_CPUTIME_ID: 464 cputime: --- 1198 unchanged lines hidden --- | 457 break; 458 case CLOCK_SECOND: 459 ts->tv_sec = 1; 460 ts->tv_nsec = 0; 461 break; 462 case CLOCK_THREAD_CPUTIME_ID: 463 case CLOCK_PROCESS_CPUTIME_ID: 464 cputime: --- 1198 unchanged lines hidden --- |