qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 1/3] qga: add support to get host time


From: Luiz Capitulino
Subject: Re: [Qemu-devel] [PATCH 1/3] qga: add support to get host time
Date: Wed, 9 Jan 2013 11:32:06 -0200

On Sun,  6 Jan 2013 18:06:58 +0800
Lei Li <address@hidden> wrote:

> Signed-off-by: Lei Li <address@hidden>
> ---
>  qga/commands-posix.c |   18 ++++++++++++++++++
>  qga/qapi-schema.json |   17 +++++++++++++++++
>  2 files changed, 35 insertions(+), 0 deletions(-)
> 
> diff --git a/qga/commands-posix.c b/qga/commands-posix.c
> index a657201..26b0fa0 100644
> --- a/qga/commands-posix.c
> +++ b/qga/commands-posix.c
> @@ -91,6 +91,24 @@ exit_err:
>      error_set(err, QERR_UNDEFINED_ERROR);
>  }
>  
> +static HostTimeInfo *get_host_time(void)
> +{

Does this build? Because no one is using this function.

> +    int err;
> +    qemu_timeval tq;
> +    HostTimeInfo *host_time;
> +
> +    err = qemu_gettimeofday(&tq);
> +    if (err < 0) {

I'd recommend taking an Error * argument and setting it with
error_set_errno().

> +        return NULL;
> +    }
> +
> +    host_time = g_malloc0(sizeof(HostTimeInfo));
> +    host_time->seconds = tq.tv_sec;
> +    host_time->microseconds = tq.tv_usec;
> +
> +    return host_time;
> +}
> +
>  typedef struct GuestFileHandle {
>      uint64_t id;
>      FILE *fh;
> diff --git a/qga/qapi-schema.json b/qga/qapi-schema.json
> index ed0eb69..7793aff 100644
> --- a/qga/qapi-schema.json
> +++ b/qga/qapi-schema.json
> @@ -83,6 +83,23 @@
>  { 'command': 'guest-ping' }
>  
>  ##
> +# @HostTimeInfo

I'm a bit confused, why do you call it HostTimeInfo if this runs
in the guest?

> +#
> +# Information about host time.
> +#
> +# @seconds: "seconds" time from the host.
> +#
> +# @microseconds: "microseconds" time from the host.
> +#
> +# @utc-offset: information about utc offset.
> +#
> +# Since: 1.4
> +##
> +{ 'type': 'HostTimeInfo',
> +  'data': { 'seconds': 'int', 'microseconds': 'int',
> +             'utc-offset': 'int' } }
> +
> +##
>  # @GuestAgentCommandInfo:
>  #
>  # Information about guest agent commands.




reply via email to

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