+/* Returns the number of timer ticks elapsed since THEN, which
+ should be a value once returned by timer_ticks(). */
+int64_t
+timer_elapsed (int64_t then)
+{
+ return timer_ticks () - then;
+}
+
+/* Suspends execution for approximately MS milliseconds. */
+void
+timer_msleep (int64_t ms)
+{
+ int64_t ticks = (int64_t) ms * TIMER_FREQ / 1000;
+ int64_t start = timer_ticks ();
+
+ while (timer_elapsed (start) < ticks)
+ continue;
+}
+
+/* Suspends execution for approximately US microseconds.
+ Note: this is ridiculously inaccurate. */
+void
+timer_usleep (int64_t us)