qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Vivier <laurent@vivier.eu>
To: "Marc-André Lureau" <marcandre.lureau@redhat.com>,
	qemu-devel <qemu-devel@nongnu.org>
Cc: Kevin Wolf <kwolf@redhat.com>, Marek Vasut <marex@denx.de>,
	Thomas Huth <thuth@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	qemu-block <qemu-block@nongnu.org>,
	David Hildenbrand <david@redhat.com>,
	Laurent Vivier <lvivier@redhat.com>,
	Michael Roth <michael.roth@amd.com>,
	Chris Wulff <crwulff@gmail.com>,
	Markus Armbruster <armbru@redhat.com>,
	Konstantin Kostiuk <kkostiuk@redhat.com>,
	Hanna Reitz <hreitz@redhat.com>, qemu-ppc <qemu-ppc@nongnu.org>,
	Stefan Weil <sw@weilnetz.de>, Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH v2 4/5] Replace qemu_gettimeofday() with g_get_real_time()
Date: Mon, 7 Mar 2022 11:02:24 +0100	[thread overview]
Message-ID: <960fea17-c5e7-fa6f-c185-8a892998cff7@vivier.eu> (raw)
In-Reply-To: <CAMxuvaz_uCxtL+0e-=AFZsuomNAz6H7Y+6RbdkSzfbxcMSLGrg@mail.gmail.com>

Le 05/03/2022 à 20:17, Marc-André Lureau a écrit :
> On Sat, Mar 5, 2022 at 1:18 AM <marcandre.lureau@redhat.com> wrote:
>>
>> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>>
>> GLib g_get_real_time() is an alternative to gettimeofday() which allows
>> to simplify our code.
>>
>> For semihosting, a few bits are lost on POSIX host, but this shouldn't
>> be a big concern.
>>
>> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
>> Reviewed-by: Laurent Vivier <laurent@vivier.eu>
>> ---
>>   blockdev.c                 |  8 ++++----
>>   hw/rtc/m41t80.c            |  6 +++---
>>   hw/virtio/virtio-balloon.c |  9 +--------
>>   qapi/qmp-event.c           | 12 +++++-------
>>   qemu-img.c                 |  8 ++++----
>>   target/m68k/m68k-semi.c    | 22 ++++++++++------------
>>   target/nios2/nios2-semi.c  | 23 ++++++++++-------------
>>   7 files changed, 37 insertions(+), 51 deletions(-)
>>
...
>> index 19d3cd003833..025716b3ec37 100644
>> --- a/qapi/qmp-event.c
>> +++ b/qapi/qmp-event.c
>> @@ -20,15 +20,13 @@
>>
>>   static void timestamp_put(QDict *qdict)
>>   {
>> -    int err;
>>       QDict *ts;
>> -    qemu_timeval tv;
>> +    int64_t rt = g_get_real_time();
>>
>> -    err = qemu_gettimeofday(&tv);
>> -    /* Put -1 to indicate failure of getting host time */
>> -    ts = qdict_from_jsonf_nofail("{ 'seconds': %lld, 'microseconds': %lld }",
>> -                                 err < 0 ? -1LL : (long long)tv.tv_sec,
>> -                                 err < 0 ? -1LL : (long long)tv.tv_usec);
>> +    ts = qdict_from_jsonf_nofail("{ 'seconds': %" G_GINT64_FORMAT
>> +                                 ", 'microseconds': %" G_GINT64_FORMAT "}",
>> +                                 rt / G_USEC_PER_SEC,
>> +                                 rt % G_USEC_PER_SEC);
> 
> NACK this, fixed in v3

Why keeping the %lld is better than moving to %G_GINT64_FORMAT?

Thanks,
Laurent


  reply	other threads:[~2022-03-07 10:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-04 21:16 [PATCH v2 0/5] Remove qemu_gettimeofday() marcandre.lureau
2022-03-04 21:16 ` [PATCH v2 1/5] m68k/nios2-semi: fix gettimeofday() result check marcandre.lureau
2022-03-04 21:16 ` [PATCH v2 2/5] qtest: replace gettimeofday with GTimer marcandre.lureau
2022-03-04 21:16 ` [PATCH v2 3/5] qga: replace qemu_gettimeofday() with g_get_real_time() marcandre.lureau
2022-03-04 21:16 ` [PATCH v2 4/5] Replace " marcandre.lureau
2022-03-05 19:17   ` Marc-André Lureau
2022-03-07 10:02     ` Laurent Vivier [this message]
2022-03-07 10:35       ` Marc-André Lureau
2022-03-07 11:36         ` Laurent Vivier
2022-03-04 21:16 ` [PATCH v2 5/5] oslib: drop qemu_gettimeofday() marcandre.lureau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=960fea17-c5e7-fa6f-c185-8a892998cff7@vivier.eu \
    --to=laurent@vivier.eu \
    --cc=armbru@redhat.com \
    --cc=crwulff@gmail.com \
    --cc=david@redhat.com \
    --cc=hreitz@redhat.com \
    --cc=kkostiuk@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=marex@denx.de \
    --cc=michael.roth@amd.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=sw@weilnetz.de \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).