2 * Copyright (c) 2010-2011 IBM
5 * Chunqiang Tang <ctang@us.ibm.com>
7 * This work is licensed under the terms of the GNU GPL, version 2.
8 * See the COPYING file in the top-level directory.
11 /*=============================================================================
12 * A short description: this module implements the qemu-tool functions that
13 * are related to time. In the simulation mode (see block/sim.c), these
14 * functions are implemented differently in qemu-test.c because they have to
15 * work with the simulation engine block/sim.c
16 *============================================================================*/
18 #include "qemu/osdep.h"
19 #include "qemu/timer.h"
28 int64_t qemu_get_clock (QEMUClock
* clock
)
31 qemu_gettimeofday (&tv
);
32 return (tv
.tv_sec
* 1000000000LL + (tv
.tv_usec
* 1000)) / 1000000;
36 QEMUBH
*qemu_bh_new (QEMUBHFunc
* cb
, void *opaque
)
40 bh
= g_malloc(sizeof(*bh
));
47 int qemu_bh_poll (void)
52 void qemu_bh_schedule (QEMUBH
* bh
)
57 void qemu_bh_cancel (QEMUBH
* bh
)
61 void qemu_bh_delete (QEMUBH
* bh
)
66 void timer_mod(QEMUTimer
* ts
, int64_t expire_time
)
68 fprintf (stderr
, "timer_mod() should not be invoked in qemu-tool\n");
72 QEMUTimer
*qemu_new_timer (QEMUClock
* clock
, QEMUTimerCB
* cb
, void *opaque
)
74 fprintf (stderr
, "qemu_new_timer() should not be invoked in qemu-tool\n");
79 void timer_free(QEMUTimer
* ts
)
81 fprintf (stderr
, "timer_free() should not be invoked in qemu-tool\n");
85 void timer_del(QEMUTimer
* ts
)
87 fprintf (stderr
, "timer_del() should not be invoked in qemu-tool\n");