Hi

On Fri, Mar 4, 2022 at 8:10 PM Laurent Vivier <laur...@vivier.eu> wrote:

> Le 04/03/2022 à 16:27, marcandre.lur...@redhat.com a écrit :
> > From: Marc-André Lureau <marcandre.lur...@redhat.com>
> >
> > GLib g_get_real_time() is an alternative to gettimeofday().
> >
> > 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.lur...@redhat.com>
> > ---
> >   blockdev.c                 |  8 ++++----
> >   hw/rtc/m41t80.c            |  6 +++---
> >   hw/virtio/virtio-balloon.c |  9 +--------
> >   qapi/qmp-event.c           | 12 +++++-------
> >   qemu-img.c                 |  8 ++++----
> >   qga/commands-posix.c       | 11 +----------
> >   target/m68k/m68k-semi.c    | 22 ++++++++++------------
> >   target/nios2/nios2-semi.c  | 24 +++++++++++-------------
> >   8 files changed, 39 insertions(+), 61 deletions(-)
> >
> ...
> > diff --git a/qga/commands-posix.c b/qga/commands-posix.c
> > index 75dbaab68ea9..3311a4ca0167 100644
> > --- a/qga/commands-posix.c
> > +++ b/qga/commands-posix.c
> > @@ -138,16 +138,7 @@ void qmp_guest_shutdown(bool has_mode, const char
> *mode, Error **errp)
> >
> >   int64_t qmp_guest_get_time(Error **errp)
> >   {
> > -   int ret;
> > -   qemu_timeval tq;
> > -
> > -   ret = qemu_gettimeofday(&tq);
> > -   if (ret < 0) {
> > -       error_setg_errno(errp, errno, "Failed to get time");
> > -       return -1;
> > -   }
> > -
> > -   return tq.tv_sec * 1000000000LL + tq.tv_usec * 1000;
> > +    return g_get_real_time();
>
> now you return microseconds, before it was nanoseconds.
>
>
my bad, will fix it in v2, thanks for noticing!


> qga/qapi-schema.json:
>
> ##
> # @guest-get-time:
> #
> # Get the information about guest's System Time relative to
> # the Epoch of 1970-01-01 in UTC.
> #
> # Returns: Time in nanoseconds.
> #
> # Since: 1.5
> ##
> { 'command': 'guest-get-time',
>    'returns': 'int' }
>
> Except this problem:
>
> Reviewed-by: Laurent Vivier <laur...@vivier.eu>
>
>

-- 
Marc-André Lureau

Reply via email to