From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:40746) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ttakt-0008Vw-MT for qemu-devel@nongnu.org; Fri, 11 Jan 2013 04:18:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ttakp-0005ei-BF for qemu-devel@nongnu.org; Fri, 11 Jan 2013 04:18:27 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47551) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ttakp-0005eW-2h for qemu-devel@nongnu.org; Fri, 11 Jan 2013 04:18:23 -0500 From: Stefan Hajnoczi Date: Fri, 11 Jan 2013 10:18:04 +0100 Message-Id: <1357895886-14283-5-git-send-email-stefanha@redhat.com> In-Reply-To: <1357895886-14283-1-git-send-email-stefanha@redhat.com> References: <1357895886-14283-1-git-send-email-stefanha@redhat.com> Subject: [Qemu-devel] [PATCH 4/6] savevm: Remove MinGW specific code which is no longer needed List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Stefan Weil , Anthony Liguori , Stefan Hajnoczi From: Stefan Weil QEMU provides a portable function qemu_gettimeofday instead of gettimeofday and also an implementation of localtime_r for MinGW. Signed-off-by: Stefan Weil Signed-off-by: Stefan Hajnoczi --- savevm.c | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) diff --git a/savevm.c b/savevm.c index 529d60e..4e970ca 100644 --- a/savevm.c +++ b/savevm.c @@ -23,15 +23,6 @@ */ #include "config-host.h" - -#ifndef _WIN32 -#include -#endif - -#ifdef _WIN32 -#include -#endif - #include "qemu-common.h" #include "hw/hw.h" #include "hw/qdev.h" @@ -2093,13 +2084,8 @@ void do_savevm(Monitor *mon, const QDict *qdict) QEMUFile *f; int saved_vm_running; uint64_t vm_state_size; -#ifdef _WIN32 - struct _timeb tb; - struct tm *ptm; -#else - struct timeval tv; + qemu_timeval tv; struct tm tm; -#endif const char *name = qdict_get_try_str(qdict, "name"); /* Verify if there is a device that doesn't support snapshots and is writable */ @@ -2129,15 +2115,9 @@ void do_savevm(Monitor *mon, const QDict *qdict) memset(sn, 0, sizeof(*sn)); /* fill auxiliary fields */ -#ifdef _WIN32 - _ftime(&tb); - sn->date_sec = tb.time; - sn->date_nsec = tb.millitm * 1000000; -#else - gettimeofday(&tv, NULL); + qemu_gettimeofday(&tv); sn->date_sec = tv.tv_sec; sn->date_nsec = tv.tv_usec * 1000; -#endif sn->vm_clock_nsec = qemu_get_clock_ns(vm_clock); if (name) { @@ -2149,15 +2129,9 @@ void do_savevm(Monitor *mon, const QDict *qdict) pstrcpy(sn->name, sizeof(sn->name), name); } } else { -#ifdef _WIN32 - time_t t = tb.time; - ptm = localtime(&t); - strftime(sn->name, sizeof(sn->name), "vm-%Y%m%d%H%M%S", ptm); -#else /* cast below needed for OpenBSD where tv_sec is still 'long' */ localtime_r((const time_t *)&tv.tv_sec, &tm); strftime(sn->name, sizeof(sn->name), "vm-%Y%m%d%H%M%S", &tm); -#endif } /* Delete old snapshots of the same name */ -- 1.8.0.2