Revision 7bd427d8

b/buffered_file.c
238 238
        return;
239 239
    }
240 240

  
241
    qemu_mod_timer(s->timer, qemu_get_clock(rt_clock) + 100);
241
    qemu_mod_timer(s->timer, qemu_get_clock_ms(rt_clock) + 100);
242 242

  
243 243
    if (s->freeze_output)
244 244
        return;
......
274 274
                             buffered_set_rate_limit,
275 275
			     buffered_get_rate_limit);
276 276

  
277
    s->timer = qemu_new_timer(rt_clock, buffered_rate_tick, s);
277
    s->timer = qemu_new_timer_ms(rt_clock, buffered_rate_tick, s);
278 278

  
279
    qemu_mod_timer(s->timer, qemu_get_clock(rt_clock) + 100);
279
    qemu_mod_timer(s->timer, qemu_get_clock_ms(rt_clock) + 100);
280 280

  
281 281
    return s->file;
282 282
}
b/console.c
1135 1135
    /* characters are pending: we send them a bit later (XXX:
1136 1136
       horrible, should change char device API) */
1137 1137
    if (s->out_fifo.count > 0) {
1138
        qemu_mod_timer(s->kbd_timer, qemu_get_clock(rt_clock) + 1);
1138
        qemu_mod_timer(s->kbd_timer, qemu_get_clock_ms(rt_clock) + 1);
1139 1139
    }
1140 1140
}
1141 1141

  
......
1457 1457

  
1458 1458
    s->out_fifo.buf = s->out_fifo_buf;
1459 1459
    s->out_fifo.buf_size = sizeof(s->out_fifo_buf);
1460
    s->kbd_timer = qemu_new_timer(rt_clock, kbd_send_chars, s);
1460
    s->kbd_timer = qemu_new_timer_ms(rt_clock, kbd_send_chars, s);
1461 1461
    s->ds = ds;
1462 1462

  
1463 1463
    if (!color_inited) {
b/hw/omap1.c
2802 2802
    s->pm_am = 0;
2803 2803
    s->auto_comp = 0;
2804 2804
    s->round = 0;
2805
    s->tick = qemu_get_clock(rt_clock);
2805
    s->tick = qemu_get_clock_ms(rt_clock);
2806 2806
    memset(&s->alarm_tm, 0, sizeof(s->alarm_tm));
2807 2807
    s->alarm_tm.tm_mday = 0x01;
2808 2808
    s->status = 1 << 7;
......
2822 2822

  
2823 2823
    s->irq = irq[0];
2824 2824
    s->alarm = irq[1];
2825
    s->clk = qemu_new_timer(rt_clock, omap_rtc_tick, s);
2825
    s->clk = qemu_new_timer_ms(rt_clock, omap_rtc_tick, s);
2826 2826

  
2827 2827
    omap_rtc_reset(s);
2828 2828

  
......
3399 3399
    struct omap_lpg_s *s = opaque;
3400 3400

  
3401 3401
    if (s->cycle)
3402
        qemu_mod_timer(s->tm, qemu_get_clock(rt_clock) + s->period - s->on);
3402
        qemu_mod_timer(s->tm, qemu_get_clock_ms(rt_clock) + s->period - s->on);
3403 3403
    else
3404
        qemu_mod_timer(s->tm, qemu_get_clock(rt_clock) + s->on);
3404
        qemu_mod_timer(s->tm, qemu_get_clock_ms(rt_clock) + s->on);
3405 3405

  
3406 3406
    s->cycle = !s->cycle;
3407 3407
    printf("%s: LED is %s\n", __FUNCTION__, s->cycle ? "on" : "off");
......
3516 3516
    struct omap_lpg_s *s = (struct omap_lpg_s *)
3517 3517
            qemu_mallocz(sizeof(struct omap_lpg_s));
3518 3518

  
3519
    s->tm = qemu_new_timer(rt_clock, omap_lpg_tick, s);
3519
    s->tm = qemu_new_timer_ms(rt_clock, omap_lpg_tick, s);
3520 3520

  
3521 3521
    omap_lpg_reset(s);
3522 3522

  
b/hw/pxa2xx.c
921 921

  
922 922
static void pxa2xx_rtc_hzupdate(PXA2xxRTCState *s)
923 923
{
924
    int64_t rt = qemu_get_clock(rt_clock);
924
    int64_t rt = qemu_get_clock_ms(rt_clock);
925 925
    s->last_rcnr += ((rt - s->last_hz) << 15) /
926 926
            (1000 * ((s->rttr & 0xffff) + 1));
927 927
    s->last_rdcr += ((rt - s->last_hz) << 15) /
......
931 931

  
932 932
static void pxa2xx_rtc_swupdate(PXA2xxRTCState *s)
933 933
{
934
    int64_t rt = qemu_get_clock(rt_clock);
934
    int64_t rt = qemu_get_clock_ms(rt_clock);
935 935
    if (s->rtsr & (1 << 12))
936 936
        s->last_swcr += (rt - s->last_sw) / 10;
937 937
    s->last_sw = rt;
......
939 939

  
940 940
static void pxa2xx_rtc_piupdate(PXA2xxRTCState *s)
941 941
{
942
    int64_t rt = qemu_get_clock(rt_clock);
942
    int64_t rt = qemu_get_clock_ms(rt_clock);
943 943
    if (s->rtsr & (1 << 15))
944 944
        s->last_swcr += rt - s->last_pi;
945 945
    s->last_pi = rt;
......
1064 1064
    case PIAR:
1065 1065
        return s->piar;
1066 1066
    case RCNR:
1067
        return s->last_rcnr + ((qemu_get_clock(rt_clock) - s->last_hz) << 15) /
1067
        return s->last_rcnr + ((qemu_get_clock_ms(rt_clock) - s->last_hz) << 15) /
1068 1068
                (1000 * ((s->rttr & 0xffff) + 1));
1069 1069
    case RDCR:
1070
        return s->last_rdcr + ((qemu_get_clock(rt_clock) - s->last_hz) << 15) /
1070
        return s->last_rdcr + ((qemu_get_clock_ms(rt_clock) - s->last_hz) << 15) /
1071 1071
                (1000 * ((s->rttr & 0xffff) + 1));
1072 1072
    case RYCR:
1073 1073
        return s->last_rycr;
1074 1074
    case SWCR:
1075 1075
        if (s->rtsr & (1 << 12))
1076
            return s->last_swcr + (qemu_get_clock(rt_clock) - s->last_sw) / 10;
1076
            return s->last_swcr + (qemu_get_clock_ms(rt_clock) - s->last_sw) / 10;
1077 1077
        else
1078 1078
            return s->last_swcr;
1079 1079
    default:
......
1219 1219
    s->last_swcr = (tm.tm_hour << 19) |
1220 1220
            (tm.tm_min << 13) | (tm.tm_sec << 7);
1221 1221
    s->last_rtcpicr = 0;
1222
    s->last_hz = s->last_sw = s->last_pi = qemu_get_clock(rt_clock);
1223

  
1224
    s->rtc_hz    = qemu_new_timer(rt_clock, pxa2xx_rtc_hz_tick,    s);
1225
    s->rtc_rdal1 = qemu_new_timer(rt_clock, pxa2xx_rtc_rdal1_tick, s);
1226
    s->rtc_rdal2 = qemu_new_timer(rt_clock, pxa2xx_rtc_rdal2_tick, s);
1227
    s->rtc_swal1 = qemu_new_timer(rt_clock, pxa2xx_rtc_swal1_tick, s);
1228
    s->rtc_swal2 = qemu_new_timer(rt_clock, pxa2xx_rtc_swal2_tick, s);
1229
    s->rtc_pi    = qemu_new_timer(rt_clock, pxa2xx_rtc_pi_tick,    s);
1222
    s->last_hz = s->last_sw = s->last_pi = qemu_get_clock_ms(rt_clock);
1223

  
1224
    s->rtc_hz    = qemu_new_timer_ms(rt_clock, pxa2xx_rtc_hz_tick,    s);
1225
    s->rtc_rdal1 = qemu_new_timer_ms(rt_clock, pxa2xx_rtc_rdal1_tick, s);
1226
    s->rtc_rdal2 = qemu_new_timer_ms(rt_clock, pxa2xx_rtc_rdal2_tick, s);
1227
    s->rtc_swal1 = qemu_new_timer_ms(rt_clock, pxa2xx_rtc_swal1_tick, s);
1228
    s->rtc_swal2 = qemu_new_timer_ms(rt_clock, pxa2xx_rtc_swal2_tick, s);
1229
    s->rtc_pi    = qemu_new_timer_ms(rt_clock, pxa2xx_rtc_pi_tick,    s);
1230 1230

  
1231 1231
    sysbus_init_irq(dev, &s->rtc_irq);
1232 1232

  
b/hw/twl92230.c
74 74

  
75 75
static inline void menelaus_rtc_start(MenelausState *s)
76 76
{
77
    s->rtc.next += qemu_get_clock(rt_clock);
77
    s->rtc.next += qemu_get_clock_ms(rt_clock);
78 78
    qemu_mod_timer(s->rtc.hz_tm, s->rtc.next);
79 79
}
80 80

  
81 81
static inline void menelaus_rtc_stop(MenelausState *s)
82 82
{
83 83
    qemu_del_timer(s->rtc.hz_tm);
84
    s->rtc.next -= qemu_get_clock(rt_clock);
84
    s->rtc.next -= qemu_get_clock_ms(rt_clock);
85 85
    if (s->rtc.next < 1)
86 86
        s->rtc.next = 1;
87 87
}
......
786 786
{
787 787
    MenelausState *s = opaque;
788 788
    /* Should be <= 1000 */
789
    s->rtc_next_vmstate =  s->rtc.next - qemu_get_clock(rt_clock);
789
    s->rtc_next_vmstate =  s->rtc.next - qemu_get_clock_ms(rt_clock);
790 790
}
791 791

  
792 792
static int menelaus_post_load(void *opaque, int version_id)
......
847 847
{
848 848
    MenelausState *s = FROM_I2C_SLAVE(MenelausState, i2c);
849 849

  
850
    s->rtc.hz_tm = qemu_new_timer(rt_clock, menelaus_rtc_hz, s);
850
    s->rtc.hz_tm = qemu_new_timer_ms(rt_clock, menelaus_rtc_hz, s);
851 851
    /* Three output pins plus one interrupt pin.  */
852 852
    qdev_init_gpio_out(&i2c->qdev, s->out, 4);
853 853
    qdev_init_gpio_in(&i2c->qdev, menelaus_gpio_set, 3);
b/hw/xen_domainbuild.c
149 149
        goto quit;
150 150
    }
151 151

  
152
    qemu_mod_timer(xen_poll, qemu_get_clock(rt_clock) + 1000);
152
    qemu_mod_timer(xen_poll, qemu_get_clock_ms(rt_clock) + 1000);
153 153
    return;
154 154

  
155 155
quit:
......
291 291
        goto err;
292 292
    }
293 293

  
294
    xen_poll = qemu_new_timer(rt_clock, xen_domain_poll, NULL);
295
    qemu_mod_timer(xen_poll, qemu_get_clock(rt_clock) + 1000);
294
    xen_poll = qemu_new_timer_ms(rt_clock, xen_domain_poll, NULL);
295
    qemu_mod_timer(xen_poll, qemu_get_clock_ms(rt_clock) + 1000);
296 296
    return 0;
297 297

  
298 298
err:
b/qemu-char.c
267 267
                int64_t ti;
268 268
                int secs;
269 269

  
270
                ti = qemu_get_clock(rt_clock);
270
                ti = qemu_get_clock_ms(rt_clock);
271 271
                if (d->timestamps_start == -1)
272 272
                    d->timestamps_start = ti;
273 273
                ti -= d->timestamps_start;
......
911 911
     * timeout to the normal (much longer) poll interval before the
912 912
     * timer triggers.
913 913
     */
914
    qemu_mod_timer(s->timer, qemu_get_clock(rt_clock) + 10);
914
    qemu_mod_timer(s->timer, qemu_get_clock_ms(rt_clock) + 10);
915 915
}
916 916

  
917 917
static void pty_chr_state(CharDriverState *chr, int connected)
......
925 925
        /* (re-)connect poll interval for idle guests: once per second.
926 926
         * We check more frequently in case the guests sends data to
927 927
         * the virtual device linked to our pty. */
928
        qemu_mod_timer(s->timer, qemu_get_clock(rt_clock) + 1000);
928
        qemu_mod_timer(s->timer, qemu_get_clock_ms(rt_clock) + 1000);
929 929
    } else {
930 930
        if (!s->connected)
931 931
            qemu_chr_generic_open(chr);
......
1001 1001
    chr->chr_update_read_handler = pty_chr_update_read_handler;
1002 1002
    chr->chr_close = pty_chr_close;
1003 1003

  
1004
    s->timer = qemu_new_timer(rt_clock, pty_chr_timer, chr);
1004
    s->timer = qemu_new_timer_ms(rt_clock, pty_chr_timer, chr);
1005 1005

  
1006 1006
    return chr;
1007 1007
}
b/qemu-timer.c
264 264
static void icount_adjust_rt(void * opaque)
265 265
{
266 266
    qemu_mod_timer(icount_rt_timer,
267
                   qemu_get_clock(rt_clock) + 1000);
267
                   qemu_get_clock_ms(rt_clock) + 1000);
268 268
    icount_adjust();
269 269
}
270 270

  
......
601 601
       the virtual time trigger catches emulated time passing too fast.
602 602
       Realtime triggers occur even when idle, so use them less frequently
603 603
       than VM triggers.  */
604
    icount_rt_timer = qemu_new_timer(rt_clock, icount_adjust_rt, NULL);
604
    icount_rt_timer = qemu_new_timer_ms(rt_clock, icount_adjust_rt, NULL);
605 605
    qemu_mod_timer(icount_rt_timer,
606
                   qemu_get_clock(rt_clock) + 1000);
606
                   qemu_get_clock_ms(rt_clock) + 1000);
607 607
    icount_vm_timer = qemu_new_timer(vm_clock, icount_adjust_vm, NULL);
608 608
    qemu_mod_timer(icount_vm_timer,
609 609
                   qemu_get_clock(vm_clock) + get_ticks_per_sec() / 10);
b/savevm.c
137 137

  
138 138
    if (--count) {
139 139
        /* delay 50ms, 150ms, 250ms, ... */
140
        qemu_mod_timer(timer, qemu_get_clock(rt_clock) +
140
        qemu_mod_timer(timer, qemu_get_clock_ms(rt_clock) +
141 141
                       50 + (SELF_ANNOUNCE_ROUNDS - count - 1) * 100);
142 142
    } else {
143 143
	    qemu_del_timer(timer);
......
148 148
void qemu_announce_self(void)
149 149
{
150 150
	static QEMUTimer *timer;
151
	timer = qemu_new_timer(rt_clock, qemu_announce_self_once, &timer);
151
	timer = qemu_new_timer_ms(rt_clock, qemu_announce_self_once, &timer);
152 152
	qemu_announce_self_once(&timer);
153 153
}
154 154

  
b/slirp/slirp.c
393 393
    global_writefds = writefds;
394 394
    global_xfds = xfds;
395 395

  
396
    curtime = qemu_get_clock(rt_clock);
396
    curtime = qemu_get_clock_ms(rt_clock);
397 397

  
398 398
    QTAILQ_FOREACH(slirp, &slirp_instances, entry) {
399 399
	/*
b/ui/spice-core.c
55 55
    SpiceTimer *timer;
56 56

  
57 57
    timer = qemu_mallocz(sizeof(*timer));
58
    timer->timer = qemu_new_timer(rt_clock, func, opaque);
58
    timer->timer = qemu_new_timer_ms(rt_clock, func, opaque);
59 59
    QTAILQ_INSERT_TAIL(&timers, timer, next);
60 60
    return timer;
61 61
}
62 62

  
63 63
static void timer_start(SpiceTimer *timer, uint32_t ms)
64 64
{
65
    qemu_mod_timer(timer->timer, qemu_get_clock(rt_clock) + ms);
65
    qemu_mod_timer(timer->timer, qemu_get_clock_ms(rt_clock) + ms);
66 66
}
67 67

  
68 68
static void timer_cancel(SpiceTimer *timer)
b/ui/vnc.c
1875 1875

  
1876 1876
    if (data[0] > 3) {
1877 1877
        vd->timer_interval = VNC_REFRESH_INTERVAL_BASE;
1878
        if (!qemu_timer_expired(vd->timer, qemu_get_clock(rt_clock) + vd->timer_interval))
1879
            qemu_mod_timer(vd->timer, qemu_get_clock(rt_clock) + vd->timer_interval);
1878
        if (!qemu_timer_expired(vd->timer, qemu_get_clock_ms(rt_clock) + vd->timer_interval))
1879
            qemu_mod_timer(vd->timer, qemu_get_clock_ms(rt_clock) + vd->timer_interval);
1880 1880
    }
1881 1881

  
1882 1882
    switch (data[0]) {
......
2441 2441

  
2442 2442
    if (vnc_trylock_display(vd)) {
2443 2443
        vd->timer_interval = VNC_REFRESH_INTERVAL_BASE;
2444
        qemu_mod_timer(vd->timer, qemu_get_clock(rt_clock) +
2444
        qemu_mod_timer(vd->timer, qemu_get_clock_ms(rt_clock) +
2445 2445
                       vd->timer_interval);
2446 2446
        return;
2447 2447
    }
......
2468 2468
        if (vd->timer_interval > VNC_REFRESH_INTERVAL_MAX)
2469 2469
            vd->timer_interval = VNC_REFRESH_INTERVAL_MAX;
2470 2470
    }
2471
    qemu_mod_timer(vd->timer, qemu_get_clock(rt_clock) + vd->timer_interval);
2471
    qemu_mod_timer(vd->timer, qemu_get_clock_ms(rt_clock) + vd->timer_interval);
2472 2472
}
2473 2473

  
2474 2474
static void vnc_init_timer(VncDisplay *vd)
2475 2475
{
2476 2476
    vd->timer_interval = VNC_REFRESH_INTERVAL_BASE;
2477 2477
    if (vd->timer == NULL && !QTAILQ_EMPTY(&vd->clients)) {
2478
        vd->timer = qemu_new_timer(rt_clock, vnc_refresh, vd);
2478
        vd->timer = qemu_new_timer_ms(rt_clock, vnc_refresh, vd);
2479 2479
        vnc_dpy_resize(vd->ds);
2480 2480
        vnc_refresh(vd);
2481 2481
    }
b/usb-linux.c
1535 1535
    }
1536 1536

  
1537 1537
    if (!usb_auto_timer) {
1538
        usb_auto_timer = qemu_new_timer(rt_clock, usb_host_auto_check, NULL);
1538
        usb_auto_timer = qemu_new_timer_ms(rt_clock, usb_host_auto_check, NULL);
1539 1539
        if (!usb_auto_timer) {
1540 1540
            return;
1541 1541
        }
1542 1542
    }
1543
    qemu_mod_timer(usb_auto_timer, qemu_get_clock(rt_clock) + 2000);
1543
    qemu_mod_timer(usb_auto_timer, qemu_get_clock_ms(rt_clock) + 2000);
1544 1544
}
1545 1545

  
1546 1546
/*
b/vl.c
1142 1142
            interval = dcl->gui_timer_interval;
1143 1143
        dcl = dcl->next;
1144 1144
    }
1145
    qemu_mod_timer(ds->gui_timer, interval + qemu_get_clock(rt_clock));
1145
    qemu_mod_timer(ds->gui_timer, interval + qemu_get_clock_ms(rt_clock));
1146 1146
}
1147 1147

  
1148 1148
static void nographic_update(void *opaque)
......
1150 1150
    uint64_t interval = GUI_REFRESH_INTERVAL;
1151 1151

  
1152 1152
    qemu_flush_coalesced_mmio_buffer();
1153
    qemu_mod_timer(nographic_timer, interval + qemu_get_clock(rt_clock));
1153
    qemu_mod_timer(nographic_timer, interval + qemu_get_clock_ms(rt_clock));
1154 1154
}
1155 1155

  
1156 1156
struct vm_change_state_entry {
......
3089 3089
    dcl = ds->listeners;
3090 3090
    while (dcl != NULL) {
3091 3091
        if (dcl->dpy_refresh != NULL) {
3092
            ds->gui_timer = qemu_new_timer(rt_clock, gui_update, ds);
3093
            qemu_mod_timer(ds->gui_timer, qemu_get_clock(rt_clock));
3092
            ds->gui_timer = qemu_new_timer_ms(rt_clock, gui_update, ds);
3093
            qemu_mod_timer(ds->gui_timer, qemu_get_clock_ms(rt_clock));
3094 3094
            break;
3095 3095
        }
3096 3096
        dcl = dcl->next;
3097 3097
    }
3098 3098
    if (ds->gui_timer == NULL) {
3099
        nographic_timer = qemu_new_timer(rt_clock, nographic_update, NULL);
3100
        qemu_mod_timer(nographic_timer, qemu_get_clock(rt_clock));
3099
        nographic_timer = qemu_new_timer_ms(rt_clock, nographic_update, NULL);
3100
        qemu_mod_timer(nographic_timer, qemu_get_clock_ms(rt_clock));
3101 3101
    }
3102 3102
    text_consoles_set_display(ds);
3103 3103

  

Also available in: Unified diff