qemu-timer.c: Use upstream version.

This completely modifies the implementation of timers to match upstream,
the only difference is that the oddly-placed qemu_gpoll_ns() function is
disabled (it's not used yet).

Most of the changes here (but not all), were applied through the following
sed script:

	s|qemu_get_clock\s*(\s*vm_clock\s*)|qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL)|g
	s|qemu_get_clock\s*(\s*rt_clock\s*)|qemu_clock_get_ms(QEMU_CLOCK_REALTIME)|g
	s|qemu_get_clock_ns\s*(\s*vm_clock\s*)|qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL)|g
	s|qemu_get_clock_ns\s*(\s*rt_clock\s*)|qemu_clock_get_ns(QEMU_CLOCK_REALTIME)|g
	s|qemu_get_clock_ms\s*(\s*vm_clock\s*)|qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL)|g
	s|qemu_get_clock_ms\s*(\s*rt_clock\s*)|qemu_clock_get_ms(QEMU_CLOCK_REALTIME)|g
	s|qemu_get_clock_ms\s*(\s*host_clock\s*)|qemu_clock_get_ms(QEMU_CLOCK_HOST)|g
	s|qemu_get_clock_ms\s*(\s*SHAPER_CLOCK\s*)|qemu_clock_get_ms(SHAPER_CLOCK)|g
	s|qemu_mod_timer\s*(|timer_mod(|g
	s|qemu_del_timer\s*(|timer_del(|g
	s|qemu_free_timer\s*(|timer_free(|g
	s|qemu_new_timer_ms\s*(\s*rt_clock,|timer_new(QEMU_CLOCK_REALTIME, SCALE_MS,|g
	s|qemu_new_timer_ns\s*(\s*rt_clock,|timer_new(QEMU_CLOCK_REALTIME, SCALE_NS,|g
	s|qemu_new_timer_ms\s*(\s*vm_clock,|timer_new(QEMU_CLOCK_VIRTUAL, SCALE_MS,|g
	s|qemu_new_timer_ns\s*(\s*vm_clock,|timer_new(QEMU_CLOCK_VIRTUAL, SCALE_NS,|g
	s|qemu_new_timer_ms\s*(\s*host_clock,|timer_new(QEMU_CLOCK_HOST, SCALE_MS,|g
	s|qemu_new_timer_ns\s*(\s*host_clock,|timer_new(QEMU_CLOCK_HOST, SCALE_NS,|g
	s|qemu_new_timer_ms\s*(\s*SHAPER_CLOCK\s*,|timer_new(SHAPER_CLOCK, SCALE_MS,|g
	s|qemu_put_timer\s*(|timer_put(|g
	s|qemu_get_timer\s*(|timer_get(|g
	s|qemu_timer_pending\s*(|timer_pending(|g
	s|qemu_clock_next_deadline\s*(\s*vm_clock|qemu_clock_deadline_ns_all(QEMU_CLOCK_VIRTUAL|g
	s|qemu_clock_next_deadline\s*(\s*rt_clock|qemu_clock_deadline_ns_all(QEMU_CLOCK_REALTIME|g
	s|qemu_clock_next_deadline\s*(\s*host_clock|qemu_clock_deadline_ns_all(QEMU_CLOCK_HOST|g

+ Disable icount-based clock warping/adjustments. It will be re-enabled in the future
  after cpu emulation has been completely refactored.

Change-Id: Ifbcf4a52654eed3a08dfe59b0546a75d4627f758
diff --git a/android/hw-sensors.c b/android/hw-sensors.c
index 494bc20..09d2e27 100644
--- a/android/hw-sensors.c
+++ b/android/hw-sensors.c
@@ -211,8 +211,8 @@
     }
     /* remove timer, if any */
     if (cl->timer) {
-        qemu_del_timer(cl->timer);
-        qemu_free_timer(cl->timer);
+        timer_del(cl->timer);
+        timer_free(cl->timer);
         cl->timer = NULL;
     }
     AFREE(cl);
@@ -232,7 +232,7 @@
     cl->sensors     = sensors;
     cl->enabledMask = 0;
     cl->delay_ms    = 800;
-    cl->timer       = qemu_new_timer_ns(vm_clock, _hwSensorClient_tick, cl);
+    cl->timer       = timer_new(QEMU_CLOCK_VIRTUAL, SCALE_NS, _hwSensorClient_tick, cl);
 
     cl->next         = sensors->clients;
     sensors->clients = cl;
@@ -337,7 +337,7 @@
         _hwSensorClient_send(cl, (uint8_t*) buffer, strlen(buffer));
     }
 
-    now_ns = qemu_get_clock_ns(vm_clock);
+    now_ns = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
 
     snprintf(buffer, sizeof buffer, "sync:%" PRId64, now_ns/1000);
     _hwSensorClient_send(cl, (uint8_t*)buffer, strlen(buffer));
@@ -352,7 +352,7 @@
         delay = 20;
 
     delay *= 1000000LL;  /* convert to nanoseconds */
-    qemu_mod_timer(cl->timer, now_ns + delay);
+    timer_mod(cl->timer, now_ns + delay);
 }
 
 /* handle incoming messages from the HAL module */
@@ -461,7 +461,7 @@
 
     qemu_put_be32(f, sc->delay_ms);
     qemu_put_be32(f, sc->enabledMask);
-    qemu_put_timer(f, sc->timer);
+    timer_put(f, sc->timer);
 }
 
 /* Loads sensor-specific client data from snapshot */
@@ -472,7 +472,7 @@
 
     sc->delay_ms = qemu_get_be32(f);
     sc->enabledMask = qemu_get_be32(f);
-    qemu_get_timer(f, sc->timer);
+    timer_get(f, sc->timer);
 
     return 0;
 }