From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:33729) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UBTMa-000413-IP for qemu-devel@nongnu.org; Fri, 01 Mar 2013 12:03:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UBTMV-000439-B7 for qemu-devel@nongnu.org; Fri, 01 Mar 2013 12:03:16 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49925) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UBTMV-00042H-1R for qemu-devel@nongnu.org; Fri, 01 Mar 2013 12:03:11 -0500 Message-ID: <5130DF3F.9080507@redhat.com> Date: Fri, 01 Mar 2013 10:02:55 -0700 From: Eric Blake 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> In-Reply-To: <1362130380-1895-2-git-send-email-lilei@linux.vnet.ibm.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="----enig2UGTQXLAOUAALQTIXWVJO" 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: Lei Li Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2UGTQXLAOUAALQTIXWVJO Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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(+) >=20 > 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 */ > } > =20 > +int64_t qmp_guest_get_time(Error **errp) > +{ > + int ret; > + qemu_timeval tq; > + int64_t time_ns; > + > + ret =3D qemu_gettimeofday(&tq); > + if (ret < 0) { > + error_setg_errno(errp, errno, "Failed to get time"); > + return -1; > + } > + > + time_ns =3D 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. > =20 > ## > +# @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 > +# > +# 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. > +# > +# Returns: Time in nanoseconds on success. > +# > +# Since 1.5 > +## > +{ 'command': 'guest-get-time', > + 'returns': 'int' } > + > +## > # @GuestAgentCommandInfo: > # > # Information about guest agent commands. >=20 --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org ------enig2UGTQXLAOUAALQTIXWVJO 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.13 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJRMN8/AAoJEKeha0olJ0Nq1CUH/RWgZL3EjW4q/At1Ai4x6Snf RQjD6juryYCimeLAAtazjQ9y4eIrpbNFzgIMScmS3hNesHSOD2e9GD+JypuzU1mk pSf0f5TSmWw2/8OQC44RitPoYjFCyrIRVjMcQtJVCLKTdKf1NscPkUth5yIZJnbH 4aMo78rjlMkCVz6oz/723XuOmAK0iQCTk9cCSjQtfQua1B25gXW4MEnAtvmKCbWs /BUk8QBcQPGUGCWfh2bfdj9nN0LsLH8Pa+ddCy9lwb+aezYPcSsrd8To4yj0/BjK 7BiTsHhHuDtfcRRk8I4YGVLVpKKifm4BMbfUCSfkS2ChhtCEcxIP9gwhlyLStSI= =YIve -----END PGP SIGNATURE----- ------enig2UGTQXLAOUAALQTIXWVJO--