qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] qtest: avoid a warning with RTC test


From: Anthony Liguori
Subject: Re: [Qemu-devel] [PATCH] qtest: avoid a warning with RTC test
Date: Fri, 30 Mar 2012 14:07:51 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120310 Thunderbird/11.0

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<address@hidden>

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);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]