From patchwork Fri Mar 30 19:05:32 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony Liguori X-Patchwork-Id: 149734 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 6B788B6FA7 for ; Sat, 31 Mar 2012 06:05:55 +1100 (EST) Received: from localhost ([::1]:57210 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SDh8y-0005aL-Fd for incoming@patchwork.ozlabs.org; Fri, 30 Mar 2012 15:05:52 -0400 Received: from eggs.gnu.org ([208.118.235.92]:47698) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SDh8l-0005Fs-TF for qemu-devel@nongnu.org; Fri, 30 Mar 2012 15:05:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SDh8k-00034x-5D for qemu-devel@nongnu.org; Fri, 30 Mar 2012 15:05:39 -0400 Received: from cpe-70-123-132-139.austin.res.rr.com ([70.123.132.139]:41949 helo=localhost6.localdomain6) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SDh8j-00034i-UH for qemu-devel@nongnu.org; Fri, 30 Mar 2012 15:05:38 -0400 Received: from localhost6.localdomain6 (localhost.localdomain [127.0.0.1]) by localhost6.localdomain6 (8.14.4/8.14.4/Debian-2ubuntu2) with ESMTP id q2UJ5WRq016517; Fri, 30 Mar 2012 14:05:32 -0500 Received: (from anthony@localhost) by localhost6.localdomain6 (8.14.4/8.14.4/Submit) id q2UJ5W33016515; Fri, 30 Mar 2012 14:05:32 -0500 From: Anthony Liguori To: qemu-devel@nongnu.org Date: Fri, 30 Mar 2012 14:05:32 -0500 Message-Id: <1333134332-16481-1-git-send-email-aliguori@us.ibm.com> X-Mailer: git-send-email 1.7.5.4 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 70.123.132.139 Cc: Stefan Weil , Anthony Liguori , Paolo Bonzini Subject: [Qemu-devel] [PATCH] qtest: use qemu_gettimeofday() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org On linux, qemu_timeval will always be two long ints. On windows, we use our own struct definition. This should fix win64. Signed-off-by: Anthony Liguori --- qtest.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/qtest.c b/qtest.c index cd7186c..daeabb7 100644 --- a/qtest.c +++ b/qtest.c @@ -31,7 +31,7 @@ static FILE *qtest_log_fp; static CharDriverState *qtest_chr; static GString *inbuf; static int irq_levels[MAX_IRQ]; -static struct timeval start_time; +static qemu_timeval start_time; static bool qtest_opened; #define FMT_timeval "%ld.%06ld" @@ -132,9 +132,9 @@ static int hex2nib(char ch) } } -static void qtest_get_time(struct timeval *tv) +static void qtest_get_time(qemu_timeval *tv) { - gettimeofday(tv, NULL); + qemu_gettimeofday(tv); tv->tv_sec -= start_time.tv_sec; tv->tv_usec -= start_time.tv_usec; if (tv->tv_usec < 0) { @@ -145,7 +145,7 @@ static void qtest_get_time(struct timeval *tv) static void qtest_send_prefix(CharDriverState *chr) { - struct timeval tv; + qemu_timeval tv; if (!qtest_log_fp || !qtest_opened) { return; @@ -195,7 +195,7 @@ static void qtest_process_command(CharDriverState *chr, gchar **words) command = words[0]; if (qtest_log_fp) { - struct timeval tv; + qemu_timeval tv; int i; qtest_get_time(&tv); @@ -394,7 +394,7 @@ static void qtest_event(void *opaque, int event) for (i = 0; i < ARRAY_SIZE(irq_levels); i++) { irq_levels[i] = 0; } - gettimeofday(&start_time, NULL); + qemu_gettimeofday(&start_time); qtest_opened = true; if (qtest_log_fp) { fprintf(qtest_log_fp, "[I " FMT_timeval "] OPENED\n", @@ -404,7 +404,7 @@ static void qtest_event(void *opaque, int event) case CHR_EVENT_CLOSED: qtest_opened = false; if (qtest_log_fp) { - struct timeval tv; + qemu_timeval tv; qtest_get_time(&tv); fprintf(qtest_log_fp, "[I +" FMT_timeval "] CLOSED\n", tv.tv_sec, tv.tv_usec);