From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34182) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yv5Dw-0006Mo-7j for qemu-devel@nongnu.org; Wed, 20 May 2015 10:43:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yv5Dn-00050E-QF for qemu-devel@nongnu.org; Wed, 20 May 2015 10:43:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58986) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yv5Dn-00050A-Ke for qemu-devel@nongnu.org; Wed, 20 May 2015 10:43:47 -0400 Message-ID: <555C9DA1.7060204@redhat.com> Date: Wed, 20 May 2015 08:43:45 -0600 From: Eric Blake MIME-Version: 1.0 References: <33183CC9F5247A488A2544077AF1902086E86BFF@SZXEMA503-MBS.china.huawei.com> In-Reply-To: <33183CC9F5247A488A2544077AF1902086E86BFF@SZXEMA503-MBS.china.huawei.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="sdFl1HttWSuKw6x60s3xtP8n1jowgGxGC" Subject: Re: [Qemu-devel] [RFC] Can we convert UTC time to local time in Qemu List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Gonglei (Arei)" , "qemu-devel@nongnu.org" Cc: "Huangpeng (Peter)" , "Herongguang (Stephen)" This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --sdFl1HttWSuKw6x60s3xtP8n1jowgGxGC Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 05/20/2015 12:29 AM, Gonglei (Arei) wrote: > Hi, >=20 > At present, Qemu use g_time_val_to_iso8601() to get the UTC added to er= ror_report() > (commit 5e2ac5191), TBH this way is very simply, we just need invoke st= andard glib functions to > complete the job.=20 local time is ambiguous (daylight savings, and even consider what happens when you physically relocate your machine to a different time zone). UTC is better. >=20 > But in the cloud computing and data center scenarios, there are many > Other open source components, such as kernel, libvirt, openstack which = are all using local time > to record the message logs, only Qemu is using the UTC time. When we wa= nt to find a error > message of Qemu, we should convert the UTC time to local time manually,= and unfortunately > different countries have different local time, what a trouble thing the= converting is. >=20 > So, my question is: Can we convert the UTC time to local time in Qemu? = Actually, libvirt uses UTC on purpose, not only because it is unambiguous, but because it prints timestamps even in situations where it must be async-signal safe, and there is no async-signal-safe way to determine the offset required to convert UTC to local time. >=20 > Any thoughts? Thanks. I'd rather stick with UTC in logs (but perhaps make it more obvious that the timestamp is UTC by actually sticking that string as part of the timestamp - libvirt is not currently doing that). --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --sdFl1HttWSuKw6x60s3xtP8n1jowgGxGC Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJVXJ2hAAoJEKeha0olJ0NqIY8H/2aeVB57JgHVnWZ5du/yCGFt 1NBL1jIY4JCW+Qv5YpyRXAEQoTHcFEfBjfdfGDQuT9YKLlEH7HSs60y4w3BjBB90 6WsMRQIkOVdIEAW9Ow1Vs72IloOYfPW8+h4A/i5UMdCF8tWSyMbiJL+0KB0OdcjK j4rC9JUx+XEoK/GrsLtE6GiLHnoSr1XC6qYsmuLxm5sMPySd6UYP8q4Xr6O5JIOU TfWqDYtdTNm2XprzrLJuKVFAxBZdUnIlB4IIJKzcFRXEaHQwFRTUgqhu6qoCAiR2 qhO9Szak/jpV4TNNw5khWMx+CTGKLnK39C8dCSgS8PWTl27fg6vqRIvC+lY538E= =j7rJ -----END PGP SIGNATURE----- --sdFl1HttWSuKw6x60s3xtP8n1jowgGxGC--