diff mbox

[PATCHv12,23/31] aio / timers: Add qemu_clock_get_ms and qemu_clock_get_ms

Message ID 1376677812-9448-24-git-send-email-alex@alex.org.uk
State New
Headers show

Commit Message

Alex Bligh Aug. 16, 2013, 6:30 p.m. UTC
Add utility functions qemu_clock_get_ms and qemu_clock_get_us

Signed-off-by: Alex Bligh <alex@alex.org.uk>
---
 include/qemu/timer.h |   28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
diff mbox

Patch

diff --git a/include/qemu/timer.h b/include/qemu/timer.h
index 3e9506c..63b964f 100644
--- a/include/qemu/timer.h
+++ b/include/qemu/timer.h
@@ -118,6 +118,34 @@  static inline int64_t qemu_clock_get_ns(QEMUClockType type)
 }
 
 /**
+ * qemu_clock_get_ms;
+ * @type: the clock type
+ *
+ * Get the millisecond value of a clock with
+ * type @type
+ *
+ * Returns: the clock value in milliseconds
+ */
+static inline int64_t qemu_clock_get_ms(QEMUClockType type)
+{
+    return qemu_clock_get_ns(type) / SCALE_MS;
+}
+
+/**
+ * qemu_clock_get_us;
+ * @type: the clock type
+ *
+ * Get the microsecond value of a clock with
+ * type @type
+ *
+ * Returns: the clock value in microseconds
+ */
+static inline int64_t qemu_clock_get_us(QEMUClockType type)
+{
+    return qemu_clock_get_ns(type) / SCALE_US;
+}
+
+/**
  * qemu_clock_has_timers:
  * @clock: the clock to operate on
  *