From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:46729) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TtYt1-0002Kn-5X for qemu-devel@nongnu.org; Fri, 11 Jan 2013 02:18:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TtYsz-0007Kz-PW for qemu-devel@nongnu.org; Fri, 11 Jan 2013 02:18:43 -0500 Received: from e28smtp04.in.ibm.com ([122.248.162.4]:56003) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TtYsz-0007Ka-4I for qemu-devel@nongnu.org; Fri, 11 Jan 2013 02:18:41 -0500 Received: from /spool/local by e28smtp04.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 11 Jan 2013 12:47:17 +0530 Received: from d28relay02.in.ibm.com (d28relay02.in.ibm.com [9.184.220.59]) by d28dlp01.in.ibm.com (Postfix) with ESMTP id 7592CE004D for ; Fri, 11 Jan 2013 12:48:43 +0530 (IST) Received: from d28av01.in.ibm.com (d28av01.in.ibm.com [9.184.220.63]) by d28relay02.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r0B7IQ6v46923860 for ; Fri, 11 Jan 2013 12:48:26 +0530 Received: from d28av01.in.ibm.com (loopback [127.0.0.1]) by d28av01.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r0B7IRpS006087 for ; Fri, 11 Jan 2013 07:18:27 GMT Message-ID: <50EFBCC1.5030700@linux.vnet.ibm.com> Date: Fri, 11 Jan 2013 15:18:25 +0800 From: Lei Li MIME-Version: 1.0 References: <1357466820-12860-1-git-send-email-lilei@linux.vnet.ibm.com> <1357466820-12860-2-git-send-email-lilei@linux.vnet.ibm.com> <50EB43AE.5000608@redhat.com> In-Reply-To: <50EB43AE.5000608@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH 1/3] qga: add support to get host time 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 01/08/2013 05:52 AM, Eric Blake wrote: > On 01/06/2013 03:06 AM, Lei Li wrote: >> Signed-off-by: Lei Li >> --- >> 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) >> +{ >> + host_time = g_malloc0(sizeof(HostTimeInfo)); >> + host_time->seconds = tq.tv_sec; >> + host_time->microseconds = tq.tv_usec; > Why usec? struct timespec with nanoseconds might be a nicer unit, even > if for the initial implementation, you use > qemu_gettimeofday().tv_usec*1000 rather than dragging in a realtime > library for full ns resolution. If nothing else, the lesson that ought > to be learned from the proliferation of time types is that any time you > don't report lots of precision, someone comes along later on having to > add yet another interface adding more precision. ok, I will have a try to change it to a ns resolution. > >> +++ b/qga/qapi-schema.json >> @@ -83,6 +83,23 @@ >> { 'command': 'guest-ping' } >> >> ## >> +# @HostTimeInfo >> +# >> +# Information about host time. >> +# >> +# @seconds: "seconds" time from the host. > Document that this is relative to the Epoch of 1970-01-01 (no matter > what the host uses for its internal reference point). Sure. > >> +# >> +# @microseconds: "microseconds" time from the host. > Again, nanoseconds (struct timespec) might be nicer. > >> +# >> +# @utc-offset: information about utc offset. > In what format? Minutes away from UTC, a 4-digit decimal value, or > something else (that is, is a one-hour offset represented as 60 or 100)? > Are negative values east or west of UTC? For this version, it's a one-hour offset represented as:±[hh]. Negative values are west, andpositive values are east of UTC. >> +# >> +# Since: 1.4 >> +## >> +{ 'type': 'HostTimeInfo', >> + 'data': { 'seconds': 'int', 'microseconds': 'int', >> + 'utc-offset': 'int' } } > Indentation seems inconsistent. > > Ah, here you made them mandatory - only your cover letter implied that > they were optional. Sorry for the inconsistent indentation. No, this is just the definition of the time structure. The optional arguments mentioned in the cover letter are for command "guest-set-time". :) -- Lei