From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:45517) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UCPze-0003w6-GD for qemu-devel@nongnu.org; Mon, 04 Mar 2013 02:39:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UCPzd-0007M0-3R for qemu-devel@nongnu.org; Mon, 04 Mar 2013 02:39:30 -0500 Received: from e23smtp05.au.ibm.com ([202.81.31.147]:36999) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UCPzc-0007Li-3A for qemu-devel@nongnu.org; Mon, 04 Mar 2013 02:39:29 -0500 Received: from /spool/local by e23smtp05.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 4 Mar 2013 17:35:13 +1000 Received: from d23relay05.au.ibm.com (d23relay05.au.ibm.com [9.190.235.152]) by d23dlp02.au.ibm.com (Postfix) with ESMTP id 197B62BB004F for ; Mon, 4 Mar 2013 18:39:18 +1100 (EST) Received: from d23av03.au.ibm.com (d23av03.au.ibm.com [9.190.234.97]) by d23relay05.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r247QYLB7995686 for ; Mon, 4 Mar 2013 18:26:35 +1100 Received: from d23av03.au.ibm.com (loopback [127.0.0.1]) by d23av03.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r247dGin015212 for ; Mon, 4 Mar 2013 18:39:17 +1100 Message-ID: <51344FA0.60103@linux.vnet.ibm.com> Date: Mon, 04 Mar 2013 15:39:12 +0800 From: Lei Li MIME-Version: 1.0 References: <1362130380-1895-1-git-send-email-lilei@linux.vnet.ibm.com> <1362130380-1895-2-git-send-email-lilei@linux.vnet.ibm.com> <5130DF3F.9080507@redhat.com> In-Reply-To: <5130DF3F.9080507@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/2] qga: add guest-get-time command List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com On 03/02/2013 01:02 AM, Eric Blake wrote: > On 03/01/2013 02:32 AM, Lei Li wrote: >> Signed-off-by: Lei Li >> --- >> qga/commands-posix.c | 16 ++++++++++++++++ >> qga/qapi-schema.json | 16 ++++++++++++++++ >> 2 files changed, 32 insertions(+) >> >> diff --git a/qga/commands-posix.c b/qga/commands-posix.c >> index 0ad73f3..f159e25 100644 >> --- a/qga/commands-posix.c >> +++ b/qga/commands-posix.c >> @@ -119,6 +119,22 @@ void qmp_guest_shutdown(bool has_mode, const char *mode, Error **err) >> /* succeded */ >> } >> >> +int64_t qmp_guest_get_time(Error **errp) >> +{ >> + int ret; >> + qemu_timeval tq; >> + int64_t time_ns; >> + >> + ret = qemu_gettimeofday(&tq); >> + if (ret < 0) { >> + error_setg_errno(errp, errno, "Failed to get time"); >> + return -1; >> + } >> + >> + time_ns = tq.tv_sec * 1000000000LL + tq.tv_usec * 1000; > Is it worth a sanity check that the tv_sec scaling doesn't overflow? Of > course, that won't happen until far into the future (well beyond the > 2038 overflow of 32-bit seconds since Epoch), so it won't hit in OUR > lifetime, so I can look the other way. >> >> ## >> +# @guest-get-time: >> +# >> +# Get the information about guest time relative to the Epoch >> +# of 1970-01-01 in UTC/GMT. > UTC and GMT are not the same thing. I'd drop the '/GMT'. > http://www.diffen.com/difference/GMT_vs_UTC Oh, good to know! :) Thanks. >> +# >> +# This command try to get the guest's notion of the current >> +# time. > This sentence is redundant with the first one, and has grammar issues. > Drop it. Sure. > >> +# >> +# Returns: Time in nanoseconds on success. >> +# >> +# Since 1.5 >> +## >> +{ 'command': 'guest-get-time', >> + 'returns': 'int' } >> + >> +## >> # @GuestAgentCommandInfo: >> # >> # Information about guest agent commands. >> -- Lei