aboutsummaryrefslogtreecommitdiffstats
path: root/extras/mini-os/h/time.h
diff options
context:
space:
mode:
authoriap10@labyrinth.cl.cam.ac.uk <iap10@labyrinth.cl.cam.ac.uk>2003-10-06 17:18:26 +0000
committeriap10@labyrinth.cl.cam.ac.uk <iap10@labyrinth.cl.cam.ac.uk>2003-10-06 17:18:26 +0000
commite4130630e189f44c1371dc8c78b66b8bcf6df732 (patch)
tree8502aa47aab90a0e59e3db0da53ada16f48a4213 /extras/mini-os/h/time.h
parentcc2ec41082ca2cc7c641794b3f52c4ee8233dc5f (diff)
downloadxen-e4130630e189f44c1371dc8c78b66b8bcf6df732.tar.gz
xen-e4130630e189f44c1371dc8c78b66b8bcf6df732.tar.bz2
xen-e4130630e189f44c1371dc8c78b66b8bcf6df732.zip
bitkeeper revision 1.483 (3f81a3e2iM-0WXaGxUS3ywM3_KZqLw)
move mini-os to extras directory
Diffstat (limited to 'extras/mini-os/h/time.h')
-rw-r--r--extras/mini-os/h/time.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/extras/mini-os/h/time.h b/extras/mini-os/h/time.h
new file mode 100644
index 0000000000..b136f4b0c3
--- /dev/null
+++ b/extras/mini-os/h/time.h
@@ -0,0 +1,59 @@
+/* -*- Mode:C; c-basic-offset:4; tab-width:4 -*-
+ ****************************************************************************
+ * (C) 2003 - Rolf Neugebauer - Intel Research Cambridge
+ ****************************************************************************
+ *
+ * File: time.h
+ * Author: Rolf Neugebauer (neugebar@dcs.gla.ac.uk)
+ * Changes:
+ *
+ * Date: Jul 2003
+ *
+ * Environment: Xen Minimal OS
+ * Description: Time and timer functions
+ *
+ ****************************************************************************
+ * $Id: h-insert.h,v 1.4 2002/11/08 16:03:55 rn Exp $
+ ****************************************************************************
+ */
+
+#ifndef _TIME_H_
+#define _TIME_H_
+
+#include <list.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);
+
+#endif /* _TIME_H_ */