aboutsummaryrefslogtreecommitdiff
path: root/src/rt/sync/timer.h
diff options
context:
space:
mode:
authorMichael Bebenita <[email protected]>2010-08-11 21:23:34 -0700
committerMichael Bebenita <[email protected]>2010-08-11 21:24:04 -0700
commit988695a96cee1eb825435260a1874b8daa0e590a (patch)
treeee92e117a653c8c6fad100e7416afe5468073ff3 /src/rt/sync/timer.h
parentSome ELF correctness issues, but apparently none enough to placate gdb. (diff)
downloadrust-988695a96cee1eb825435260a1874b8daa0e590a.tar.xz
rust-988695a96cee1eb825435260a1874b8daa0e590a.zip
Added support for task sleeping in the scheduler.
Diffstat (limited to 'src/rt/sync/timer.h')
-rw-r--r--src/rt/sync/timer.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/rt/sync/timer.h b/src/rt/sync/timer.h
new file mode 100644
index 00000000..509fd22c
--- /dev/null
+++ b/src/rt/sync/timer.h
@@ -0,0 +1,25 @@
+/*
+ * Utility class to measure time in a platform independent way.
+ */
+
+#ifndef TIMER_H
+#define TIMER_H
+
+class timer {
+private:
+ uint64_t _start;
+ uint64_t _timeout;
+ uint64_t get_time();
+#if __WIN32__
+ uint64_t _ticks_per_us;
+#endif
+public:
+ timer();
+ void reset(uint64_t timeout);
+ uint64_t get_elapsed_time();
+ int64_t get_timeout();
+ bool has_timed_out();
+ virtual ~timer();
+};
+
+#endif /* TIMER_H */