From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:48300) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SDhAz-0007ET-HO for qemu-devel@nongnu.org; Fri, 30 Mar 2012 15:07:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SDhAx-0003dm-K5 for qemu-devel@nongnu.org; Fri, 30 Mar 2012 15:07:57 -0400 Received: from mail-ob0-f173.google.com ([209.85.214.173]:62587) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SDhAx-0003df-F0 for qemu-devel@nongnu.org; Fri, 30 Mar 2012 15:07:55 -0400 Received: by obbwd20 with SMTP id wd20so1493478obb.4 for ; Fri, 30 Mar 2012 12:07:54 -0700 (PDT) Message-ID: <4F760487.7020205@codemonkey.ws> Date: Fri, 30 Mar 2012 14:07:51 -0500 From: Anthony Liguori MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] qtest: avoid a warning with RTC test List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Blue Swirl Cc: Paolo Bonzini , Anthony Liguori , qemu-devel On 03/30/2012 01:59 PM, Blue Swirl wrote: > Avoid this warning on OpenBSD: > CC tests/rtc-test.o > /src/qemu/tests/rtc-test.c: In function 'check_time': > /src/qemu/tests/rtc-test.c:171: warning: format '%ld' expects type > 'long int', but argument 2 has type 'time_t' > /src/qemu/tests/rtc-test.c:173: warning: format '%ld' expects type > 'long int', but argument 2 has type 'time_t' > > Signed-off-by: Blue Swirl I'd prefer to make t and s longs so that the casts weren't needed. It will make the issue less likely to come up later. Regards, Anthony Liguori > --- > tests/rtc-test.c | 6 ++++-- > 1 files changed, 4 insertions(+), 2 deletions(-) > > diff --git a/tests/rtc-test.c b/tests/rtc-test.c > index c32b36a..a5d4519 100644 > --- a/tests/rtc-test.c > +++ b/tests/rtc-test.c > @@ -168,9 +168,11 @@ static void check_time(int wiggle) > t = mktime(datep); > s = mktime(&start); > if (t< s) { > - g_test_message("RTC is %ld second(s) behind > wall-clock\n", (s - t)); > + g_test_message("RTC is %ld second(s) behind wall-clock\n", > + (long)(s - t)); > } else { > - g_test_message("RTC is %ld second(s) ahead of > wall-clock\n", (t - s)); > + g_test_message("RTC is %ld second(s) ahead of wall-clock\n", > + (long)(t - s)); > } > > g_assert_cmpint(ABS(t - s),<=, wiggle);