From b819cea2f73f98c5662230cc9affc8cc84f77fcf Mon Sep 17 00:00:00 2001 From: Gordon Ross Date: Mon, 17 Jun 2013 10:34:00 -0400 Subject: 5917 User-mode SMB server Authored by: Thomas Keiser Authored by: Albert Lee Reviewed by: Igor Kozhukhov Reviewed by: Richard Lowe Reviewed by: Albert Lee Approved by: Dan McDonald --- usr/src/lib/libfakekernel/common/clock.c | 92 ++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 usr/src/lib/libfakekernel/common/clock.c (limited to 'usr/src/lib/libfakekernel/common/clock.c') diff --git a/usr/src/lib/libfakekernel/common/clock.c b/usr/src/lib/libfakekernel/common/clock.c new file mode 100644 index 0000000000..dde86bdcfd --- /dev/null +++ b/usr/src/lib/libfakekernel/common/clock.c @@ -0,0 +1,92 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2014 Nexenta Systems, Inc. All rights reserved. + */ + + +#include +#include +#include +#include + +#include + +#include + +int hz = 1000; +int tick_per_msec = 0; +int msec_per_tick = 1; +int usec_per_tick = 1000; +int nsec_per_tick = 1000000; +time_t boot_time = 0; + +#pragma init(_boot_time_init) +static int +_boot_time_init(void) +{ + boot_time = time(NULL); + return (0); +} + +clock_t +ddi_get_lbolt(void) +{ + hrtime_t hrt; + + hrt = gethrtime(); + return (hrt / nsec_per_tick); +} + +int64_t +ddi_get_lbolt64(void) +{ + hrtime_t hrt; + + hrt = gethrtime(); + return (hrt / nsec_per_tick); +} + +void +clock2ts(clock_t clk, timespec_t *ts) +{ + ts->tv_sec = clk / hz; + ts->tv_nsec = (clk % hz) * (NANOSEC / hz); +} + +hrtime_t +gethrtime_unscaled(void) +{ + return (gethrtime()); +} + +void +gethrestime(timespec_t *ts) +{ + hrtime_t hrt; + + hrt = gethrtime(); + ts->tv_sec = hrt / NANOSEC; + ts->tv_nsec = hrt % NANOSEC; +} + +time_t +gethrestime_sec(void) +{ + return (time(NULL)); +} + +/* ARGSUSED */ +void +scalehrtime(hrtime_t *t) +{ +} -- cgit v1.2.3