summaryrefslogtreecommitdiffstats
path: root/rtemsbsd/src/rtems-bsd-timesupport.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@oarcorp.com>2012-04-04 17:38:25 -0500
committerJoel Sherrill <joel.sherrill@oarcorp.com>2012-04-04 17:38:25 -0500
commitdc4c4909f07e90182796ebfd9cc72e7929920d2f (patch)
tree2c869738a3df7775719253e21180752c722915ce /rtemsbsd/src/rtems-bsd-timesupport.c
parentAdd hogticks (diff)
downloadrtems-libbsd-dc4c4909f07e90182796ebfd9cc72e7929920d2f.tar.bz2
Add tvtohz() implementation in new file
Diffstat (limited to 'rtemsbsd/src/rtems-bsd-timesupport.c')
-rw-r--r--rtemsbsd/src/rtems-bsd-timesupport.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/rtemsbsd/src/rtems-bsd-timesupport.c b/rtemsbsd/src/rtems-bsd-timesupport.c
new file mode 100644
index 00000000..4e6998e4
--- /dev/null
+++ b/rtemsbsd/src/rtems-bsd-timesupport.c
@@ -0,0 +1,38 @@
+/**
+ * @file
+ *
+ * @ingroup rtems_bsd_rtems
+ *
+ * @brief TODO.
+ */
+
+/*
+ * COPYRIGHT (c) 1989-2012.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ */
+
+/*
+ * This violation is specifically for _Timespec_To_ticks
+ */
+#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
+#include <freebsd/machine/rtems-bsd-config.h>
+
+#include <rtems/score/timespec.h>
+
+/*
+ * Compute number of ticks in the specified amount of time.
+ */
+int
+tvtohz(struct timeval *tv)
+{
+ struct timespec ts;
+
+ ts.tv_sec = tv->tv_sec;
+ ts.tv_nsec = tv->tv_usec * 1000;
+
+ (int) _Timespec_To_ticks( &ts );
+}