diff --git a/qemu-timer.c b/qemu-timer.c
index 2db87ba..471150c 100644
--- a/qemu-timer.c
+++ b/qemu-timer.c
@@ -314,6 +314,10 @@ static void timerlist_rearm(QEMUTimerList *timer_list)
     timerlist_notify(timer_list);
 }
 
+/*
+ * QEMUClockType
+ */
+
 static void qemu_clock_init(QEMUClockType type)
 {
     QEMUClock *clock = qemu_clock_ptr(type);
@@ -326,11 +330,71 @@ static void qemu_clock_init(QEMUClockType type)
     main_loop_tlg.tl[type] = timerlist_new(type, NULL, NULL);
 }
 
+int64_t qemu_clock_get_ns(QEMUClockType type)
+{
+    int64_t now, last;
+    QEMUClock *clock = qemu_clock_ptr(type);
+
+    switch (type) {
+    case QEMU_CLOCK_REALTIME:
+        return get_clock();
+    default:
+    case QEMU_CLOCK_VIRTUAL:
+        if (use_icount) {
+            return cpu_get_icount();
+        } else {
+            return cpu_get_clock();
+        }
+    case QEMU_CLOCK_HOST:
+        now = get_clock_realtime();
+        last = clock->last;
+        clock->last = now;
+        if (now < last) {
+            notifier_list_notify(&clock->reset_notifiers, &now);
+        }
+        return now;
+    }
+}
+
+bool qemu_clock_has_timers(QEMUClockType type)
+{
+    return timerlist_has_timers(
+        main_loop_tlg.tl[type]);
+}
+
+bool qemu_clock_expired(QEMUClockType type)
+{
+    return timerlist_expired(
+        main_loop_tlg.tl[type]);
+}
+
 bool qemu_clock_use_for_deadline(QEMUClockType type)
 {
     return !(use_icount && (type == QEMU_CLOCK_VIRTUAL));
 }
 
+/* Calculate the soonest deadline across all timerlists attached
+ * to the clock. This is used for the icount timeout so we
+ * ignore whether or not the clock should be used in deadline
+ * calculations.
+ */
+int64_t qemu_clock_deadline_ns_all(QEMUClockType type)
+{
+    int64_t deadline = -1;
+    QEMUTimerList *timer_list;
+    QEMUClock *clock = qemu_clock_ptr(type);
+    QLIST_FOREACH(timer_list, &clock->timerlists, list) {
+        deadline = qemu_soonest_timeout(deadline,
+                                        timerlist_deadline_ns(timer_list));
+    }
+    return deadline;
+}
+
+QEMUTimerList *qemu_clock_get_main_loop_timerlist(QEMUClockType type)
+{
+    return main_loop_tlg.tl[type];
+}
+
 void qemu_clock_notify(QEMUClockType type)
 {
     QEMUTimerList *timer_list;
@@ -362,38 +426,34 @@ void qemu_clock_enable(QEMUClockType type, bool enabled)
     }
 }
 
-bool qemu_clock_has_timers(QEMUClockType type)
+void qemu_clock_register_reset_notifier(QEMUClockType type,
+                                        Notifier *notifier)
 {
-    return timerlist_has_timers(
-        main_loop_tlg.tl[type]);
+    QEMUClock *clock = qemu_clock_ptr(type);
+    notifier_list_add(&clock->reset_notifiers, notifier);
 }
 
-bool qemu_clock_expired(QEMUClockType type)
+void qemu_clock_unregister_reset_notifier(QEMUClockType type,
+                                          Notifier *notifier)
 {
-    return timerlist_expired(
-        main_loop_tlg.tl[type]);
+    notifier_remove(notifier);
 }
 
-/* Calculate the soonest deadline across all timerlists attached
- * to the clock. This is used for the icount timeout so we
- * ignore whether or not the clock should be used in deadline
- * calculations.
- */
-int64_t qemu_clock_deadline_ns_all(QEMUClockType type)
+bool qemu_clock_run_timers(QEMUClockType type)
 {
-    int64_t deadline = -1;
-    QEMUTimerList *timer_list;
-    QEMUClock *clock = qemu_clock_ptr(type);
-    QLIST_FOREACH(timer_list, &clock->timerlists, list) {
-        deadline = qemu_soonest_timeout(deadline,
-                                        timerlist_deadline_ns(timer_list));
-    }
-    return deadline;
+    return timerlist_run_timers(main_loop_tlg.tl[type]);
 }
 
-QEMUTimerList *qemu_clock_get_main_loop_timerlist(QEMUClockType type)
+bool qemu_clock_run_all_timers(void)
 {
-    return main_loop_tlg.tl[type];
+    bool progress = false;
+    QEMUClockType type;
+
+    for (type = 0; type < QEMU_CLOCK_MAX; type++) {
+        progress |= qemu_clock_run_timers(type);
+    }
+
+    return progress;
 }
 
 /* Transition function to convert a nanosecond timeout to ms
@@ -570,11 +630,6 @@ bool timer_expired(QEMUTimer *timer_head, int64_t current_time)
     return timer_expired_ns(timer_head, current_time * timer_head->scale);
 }
 
-bool qemu_clock_run_timers(QEMUClockType type)
-{
-    return timerlist_run_timers(main_loop_tlg.tl[type]);
-}
-
 void timerlistgroup_init(QEMUTimerListGroup *tlg,
                          QEMUTimerListNotifyCB *cb, void *opaque)
 {
@@ -616,45 +671,6 @@ int64_t timerlistgroup_deadline_ns(QEMUTimerListGroup *tlg)
     return deadline;
 }
 
-int64_t qemu_clock_get_ns(QEMUClockType type)
-{
-    int64_t now, last;
-    QEMUClock *clock = qemu_clock_ptr(type);
-
-    switch (type) {
-    case QEMU_CLOCK_REALTIME:
-        return get_clock();
-    default:
-    case QEMU_CLOCK_VIRTUAL:
-        if (use_icount) {
-            return cpu_get_icount();
-        } else {
-            return cpu_get_clock();
-        }
-    case QEMU_CLOCK_HOST:
-        now = get_clock_realtime();
-        last = clock->last;
-        clock->last = now;
-        if (now < last) {
-            notifier_list_notify(&clock->reset_notifiers, &now);
-        }
-        return now;
-    }
-}
-
-void qemu_clock_register_reset_notifier(QEMUClockType type,
-                                        Notifier *notifier)
-{
-    QEMUClock *clock = qemu_clock_ptr(type);
-    notifier_list_add(&clock->reset_notifiers, notifier);
-}
-
-void qemu_clock_unregister_reset_notifier(QEMUClockType type,
-                                          Notifier *notifier)
-{
-    notifier_remove(notifier);
-}
-
 void init_clocks(void)
 {
     QEMUClockType type;
@@ -671,15 +687,3 @@ uint64_t timer_expire_time_ns(QEMUTimer *ts)
 {
     return timer_pending(ts) ? ts->expire_time : -1;
 }
-
-bool qemu_clock_run_all_timers(void)
-{
-    bool progress = false;
-    QEMUClockType type;
-
-    for (type = 0; type < QEMU_CLOCK_MAX; type++) {
-        progress |= qemu_clock_run_timers(type);
-    }
-
-    return progress;
-}
