* [Qemu-devel] [PATCH] qtest: avoid a warning with RTC test
@ 2012-03-30 18:59 Blue Swirl
2012-03-30 19:07 ` Anthony Liguori
0 siblings, 1 reply; 2+ messages in thread
From: Blue Swirl @ 2012-03-30 18:59 UTC (permalink / raw)
To: Anthony Liguori, Paolo Bonzini; +Cc: qemu-devel
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 <blauwirbel@gmail.com>
---
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);
--
1.7.9
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] qtest: avoid a warning with RTC test
2012-03-30 18:59 [Qemu-devel] [PATCH] qtest: avoid a warning with RTC test Blue Swirl
@ 2012-03-30 19:07 ` Anthony Liguori
0 siblings, 0 replies; 2+ messages in thread
From: Anthony Liguori @ 2012-03-30 19:07 UTC (permalink / raw)
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<blauwirbel@gmail.com>
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);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-03-30 19:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-30 18:59 [Qemu-devel] [PATCH] qtest: avoid a warning with RTC test Blue Swirl
2012-03-30 19:07 ` Anthony Liguori
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.