From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:41711) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TsKcm-0006xw-VA for qemu-devel@nongnu.org; Mon, 07 Jan 2013 16:52:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TsKck-0001AC-Oj for qemu-devel@nongnu.org; Mon, 07 Jan 2013 16:52:52 -0500 Received: from mx1.redhat.com ([209.132.183.28]:2631) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TsKck-0001A2-Gv for qemu-devel@nongnu.org; Mon, 07 Jan 2013 16:52:50 -0500 Message-ID: <50EB43AE.5000608@redhat.com> Date: Mon, 07 Jan 2013 14:52:46 -0700 From: Eric Blake 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> In-Reply-To: <1357466820-12860-2-git-send-email-lilei@linux.vnet.ibm.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enig87FBEBEC3F5A5F4E43AD795A" 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: Lei Li Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig87FBEBEC3F5A5F4E43AD795A Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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(-) >=20 > 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); > } > =20 > +static HostTimeInfo *get_host_time(void) > +{ > + host_time =3D g_malloc0(sizeof(HostTimeInfo)); > + host_time->seconds =3D tq.tv_sec; > + host_time->microseconds =3D 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. > +++ b/qga/qapi-schema.json > @@ -83,6 +83,23 @@ > { 'command': 'guest-ping' } > =20 > ## > +# @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). > +# > +# @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? > +# > +# 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. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --------------enig87FBEBEC3F5A5F4E43AD795A Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with undefined - http://www.enigmail.net/ iQEcBAEBCAAGBQJQ60OuAAoJEKeha0olJ0Nq3NUIAKpTTL5hzYbf7Mjtw23uhIzy ktArsHZfx8e2K6VYG9QRmAQHH8OIJX/XrmK69d0aSsx81vAMBffaMo8cCNY9Bv2Q 0ljAfV3KLJ3iuYWXPi3ArNS6rR9edhoXp3P8x6yRogBNLkja/bHpynPzBXsimFKX mVqyxWOxY9aGrb7ReVVX2FUJmXnWX6vV6+/dNBH6RAQ881vfkJxIL7OVusY58BWm puhUPaX5LU9IlDhdJsw3eSHNrQw1DiUdHSUlXY8xnHZtRNbF8KNfwp0a2HrutphM TFm6Si/SSclmlpHjozQBpqW6aThDiqMj3aKvK85NUO+WdgH4fCAwNBGArDUl+GM= =HJVw -----END PGP SIGNATURE----- --------------enig87FBEBEC3F5A5F4E43AD795A--