qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2] qtest: avoid a warning with RTC test
@ 2012-03-30 19:19 Blue Swirl
  2012-03-30 19:21 ` Anthony Liguori
  0 siblings, 1 reply; 3+ messages in thread
From: Blue Swirl @ 2012-03-30 19:19 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>
---

v2: make t and s longs.

---
 tests/rtc-test.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/rtc-test.c b/tests/rtc-test.c
index c32b36a..983a980 100644
--- a/tests/rtc-test.c
+++ b/tests/rtc-test.c
@@ -161,12 +161,12 @@ static void check_time(int wiggle)
     }

     if (!(tm_cmp(&start, datep) <= 0 && tm_cmp(datep, &end) <= 0)) {
-        time_t t, s;
+        long t, s;

         start.tm_isdst = datep->tm_isdst;

-        t = mktime(datep);
-        s = mktime(&start);
+        t = (long)mktime(datep);
+        s = (long)mktime(&start);
         if (t < s) {
             g_test_message("RTC is %ld second(s) behind
wall-clock\n", (s - t));
         } else {
-- 
1.7.9

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH v2] qtest: avoid a warning with RTC test
  2012-03-30 19:19 [Qemu-devel] [PATCH v2] qtest: avoid a warning with RTC test Blue Swirl
@ 2012-03-30 19:21 ` Anthony Liguori
  2012-03-30 20:07   ` Blue Swirl
  0 siblings, 1 reply; 3+ messages in thread
From: Anthony Liguori @ 2012-03-30 19:21 UTC (permalink / raw)
  To: Blue Swirl; +Cc: Paolo Bonzini, Anthony Liguori, qemu-devel

On 03/30/2012 02:19 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>

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>

Regards,

Anthony Liguori

> ---
>
> v2: make t and s longs.
>
> ---
>   tests/rtc-test.c |    6 +++---
>   1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/tests/rtc-test.c b/tests/rtc-test.c
> index c32b36a..983a980 100644
> --- a/tests/rtc-test.c
> +++ b/tests/rtc-test.c
> @@ -161,12 +161,12 @@ static void check_time(int wiggle)
>       }
>
>       if (!(tm_cmp(&start, datep)<= 0&&  tm_cmp(datep,&end)<= 0)) {
> -        time_t t, s;
> +        long t, s;
>
>           start.tm_isdst = datep->tm_isdst;
>
> -        t = mktime(datep);
> -        s = mktime(&start);
> +        t = (long)mktime(datep);
> +        s = (long)mktime(&start);
>           if (t<  s) {
>               g_test_message("RTC is %ld second(s) behind
> wall-clock\n", (s - t));
>           } else {

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH v2] qtest: avoid a warning with RTC test
  2012-03-30 19:21 ` Anthony Liguori
@ 2012-03-30 20:07   ` Blue Swirl
  0 siblings, 0 replies; 3+ messages in thread
From: Blue Swirl @ 2012-03-30 20:07 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: Paolo Bonzini, Anthony Liguori, qemu-devel

On Fri, Mar 30, 2012 at 19:21, Anthony Liguori <anthony@codemonkey.ws> wrote:
> On 03/30/2012 02:19 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>
>
>
> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>

Thanks for the review, applied.

Actually the logic may fail in 2038 if longs are still 32 bits. Better
not run qtest then.

> Regards,
>
> Anthony Liguori
>
>> ---
>>
>> v2: make t and s longs.
>>
>> ---
>>  tests/rtc-test.c |    6 +++---
>>  1 files changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/tests/rtc-test.c b/tests/rtc-test.c
>> index c32b36a..983a980 100644
>> --- a/tests/rtc-test.c
>> +++ b/tests/rtc-test.c
>> @@ -161,12 +161,12 @@ static void check_time(int wiggle)
>>      }
>>
>>      if (!(tm_cmp(&start, datep)<= 0&&  tm_cmp(datep,&end)<= 0)) {
>>
>> -        time_t t, s;
>> +        long t, s;
>>
>>          start.tm_isdst = datep->tm_isdst;
>>
>> -        t = mktime(datep);
>> -        s = mktime(&start);
>> +        t = (long)mktime(datep);
>> +        s = (long)mktime(&start);
>>          if (t<  s) {
>>              g_test_message("RTC is %ld second(s) behind
>> wall-clock\n", (s - t));
>>          } else {
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-03-30 20:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-30 19:19 [Qemu-devel] [PATCH v2] qtest: avoid a warning with RTC test Blue Swirl
2012-03-30 19:21 ` Anthony Liguori
2012-03-30 20:07   ` Blue Swirl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).