Skip to contentSkip to conversation

Compile fix for win32

Qemu-devel Kazu 1 participant 1 message Aug 7, 2006

lore
Share & tools
lore

Kazu

author
#0 lore raw

Hi,

An attatched patch fixes compile error for win32.

Regards,
Kazu

Index: vl.c
===================================================================
RCS file: /sources/qemu/qemu/vl.c,v
retrieving revision 1.206

vl.c +10 -0
diff -u -r1.206 vl.c
@@ -4539,7 +4539,11 @@
     BlockDriverInfo bdi1, *bdi = &bdi1;
     QEMUFile *f;
     int saved_vm_running;
+#ifdef _WIN32
+    struct _timeb tb;
+#else
     struct timeval tv;
+#endif
 
     bs = get_bs_snapshots();
     if (!bs) {
@@ -4567,9 +4571,15 @@
     }
 
     /* fill auxiliary fields */
+#ifdef _WIN32
+    _ftime(&tb);
+    sn->date_sec = tb.time;
+    sn->date_nsec = tb.millitm * 1000000;
+#else
     gettimeofday(&tv, NULL);
     sn->date_sec = tv.tv_sec;
     sn->date_nsec = tv.tv_usec * 1000;
+#endif
     sn->vm_clock_nsec = qemu_get_clock(vm_clock);
     
     if (bdrv_get_info(bs, bdi) < 0 || bdi->vm_state_offset <= 0) {