aboutsummaryrefslogtreecommitdiffstats
path: root/extras/mini-os/include/time.h
diff options
context:
space:
mode:
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>2005-07-06 10:46:29 +0000
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>2005-07-06 10:46:29 +0000
commitb7d34829a343a9fcc9e5d6a64d6138bc6ce0d160 (patch)
tree55fdbbc8a6878bbfcbc00826dce1138f17d721e2 /extras/mini-os/include/time.h
parent3f54e6d5ece9b20caa0fd77d2c8342c69c6733b2 (diff)
downloadxen-b7d34829a343a9fcc9e5d6a64d6138bc6ce0d160.tar.gz
xen-b7d34829a343a9fcc9e5d6a64d6138bc6ce0d160.tar.bz2
xen-b7d34829a343a9fcc9e5d6a64d6138bc6ce0d160.zip
Mini-os updates from Grzegorz Milos.
Diffstat (limited to 'extras/mini-os/include/time.h')
-rw-r--r--extras/mini-os/include/time.h57
1 files changed, 57 insertions, 0 deletions
diff --git a/extras/mini-os/include/time.h b/extras/mini-os/include/time.h
new file mode 100644
index 0000000000..40b4c212fa
--- /dev/null
+++ b/extras/mini-os/include/time.h
@@ -0,0 +1,57 @@
+/* -*- Mode:C; c-basic-offset:4; tab-width:4 -*-
+ ****************************************************************************
+ * (C) 2003 - Rolf Neugebauer - Intel Research Cambridge
+ * (C) 2005 - Grzegorz Milos - Intel Research Cambridge
+ ****************************************************************************
+ *
+ * File: time.h
+ * Author: Rolf Neugebauer (neugebar@dcs.gla.ac.uk)
+ * Changes: Grzegorz Milos (gm281@cam.ac.uk)
+ *
+ * Date: Jul 2003, changesJun 2005
+ *
+ * Environment: Xen Minimal OS
+ * Description: Time and timer functions
+ *
+ ****************************************************************************
+ */
+
+#ifndef _TIME_H_
+#define _TIME_H_
+
+/*
+ * System Time
+ * 64 bit value containing the nanoseconds elapsed since boot time.
+ * This value is adjusted by frequency drift.
+ * NOW() returns the current time.
+ * The other macros are for convenience to approximate short intervals
+ * of real time into system time
+ */
+typedef s64 s_time_t;
+#define NOW() ((s_time_t)get_s_time())
+#define SECONDS(_s) (((s_time_t)(_s)) * 1000000000UL )
+#define TENTHS(_ts) (((s_time_t)(_ts)) * 100000000UL )
+#define HUNDREDTHS(_hs) (((s_time_t)(_hs)) * 10000000UL )
+#define MILLISECS(_ms) (((s_time_t)(_ms)) * 1000000UL )
+#define MICROSECS(_us) (((s_time_t)(_us)) * 1000UL )
+#define Time_Max ((s_time_t) 0x7fffffffffffffffLL)
+#define FOREVER Time_Max
+
+
+/* wall clock time */
+typedef long time_t;
+typedef long suseconds_t;
+struct timeval {
+ time_t tv_sec; /* seconds */
+ suseconds_t tv_usec; /* microseconds */
+};
+
+
+/* prototypes */
+void init_time(void);
+s_time_t get_s_time(void);
+s_time_t get_v_time(void);
+void gettimeofday(struct timeval *tv);
+void block(u32 millisecs);
+
+#endif /* _TIME_H_ */