2 * This file and its contents are supplied under the terms of the
3 * Common Development and Distribution License ("CDDL"), version 1.0.
4 * You may only use this file in accordance with the terms of version
7 * A full copy of the text of the CDDL should have accompanied this
8 * source. A copy of the CDDL is also available via the Internet at
9 * http://www.illumos.org/license/CDDL.
13 * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
17 #include <sys/types.h>
19 #include <sys/thread.h>
27 int tick_per_msec
= 0;
28 int msec_per_tick
= 1;
29 int usec_per_tick
= 1000;
30 int nsec_per_tick
= 1000000;
33 #pragma init(_boot_time_init)
37 boot_time
= time(NULL
);
47 return (hrt
/ nsec_per_tick
);
56 return (hrt
/ nsec_per_tick
);
60 clock2ts(clock_t clk
, timespec_t
*ts
)
62 ts
->tv_sec
= clk
/ hz
;
63 ts
->tv_nsec
= (clk
% hz
) * (NANOSEC
/ hz
);
67 gethrtime_unscaled(void)
73 gethrestime(timespec_t
*ts
)
77 (void) gettimeofday(&tv
, NULL
);
78 ts
->tv_sec
= tv
.tv_sec
;
79 ts
->tv_nsec
= tv
.tv_usec
* 1000;
90 scalehrtime(hrtime_t
*t
)