From nobody Thu May 2 02:35:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1508726748351822.2105938906434; Sun, 22 Oct 2017 19:45:48 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 46EE2821C3; Mon, 23 Oct 2017 02:45:46 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A95045C3FA; Mon, 23 Oct 2017 02:45:44 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 3DC6E1800C98; Mon, 23 Oct 2017 02:45:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v9N2jc2x002514 for ; Sun, 22 Oct 2017 22:45:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id DDBE86031A; Mon, 23 Oct 2017 02:45:38 +0000 (UTC) Received: from mx1.redhat.com (ext-mx01.extmail.prod.ext.phx2.redhat.com [10.5.110.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 90962600CD for ; Mon, 23 Oct 2017 02:45:36 +0000 (UTC) Received: from mxct.zte.com.cn (out1.zte.com.cn [202.103.147.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B95E981DEE for ; Mon, 23 Oct 2017 02:45:34 +0000 (UTC) Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id 2AD0B652BFC41AA8670E for ; Mon, 23 Oct 2017 10:29:28 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id v9N2TEHI014274 for ; Mon, 23 Oct 2017 10:29:14 +0800 (GMT-8) (envelope-from lu.zhipeng@zte.com.cn) Received: from ceshi.localdomain ([10.74.120.130]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2017102310291518-1232125 ; Mon, 23 Oct 2017 10:29:15 +0800 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 46EE2821C3 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=zte.com.cn Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 46EE2821C3 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B95E981DEE Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=zte.com.cn Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=lu.zhipeng@zte.com.cn DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com B95E981DEE From: ZhiPeng Lu To: libvir-list@redhat.com Date: Mon, 23 Oct 2017 10:29:08 +0800 Message-Id: <1508725748-15281-1-git-send-email-lu.zhipeng@zte.com.cn> X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2017-10-23 10:29:15, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2017-10-23 10:29:13, Serialize complete at 2017-10-23 10:29:13 X-MAIL: mse01.zte.com.cn v9N2TEHI014274 X-Greylist: Delayed for 00:16:05 by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 23 Oct 2017 02:45:35 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 23 Oct 2017 02:45:35 +0000 (UTC) for IP:'202.103.147.172' DOMAIN:'out1.zte.com.cn' HELO:'mxct.zte.com.cn' FROM:'lu.zhipeng@zte.com.cn' RCPT:'' X-RedHat-Spam-Score: -0.002 (RP_MATCHES_RCVD, SPF_PASS) 202.103.147.172 out1.zte.com.cn 202.103.147.172 out1.zte.com.cn X-Scanned-By: MIMEDefang 2.78 on 10.5.110.25 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: ZhiPeng Lu Subject: [libvirt] [PATCH] Add output of local time when adding the option of "--pretty" for virsh domtime X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 23 Oct 2017 02:45:47 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add more human-friendly output of domain's system time. Signed-off-by: ZhiPeng Lu Reviewed-by: Jiyun Fan --- tools/virsh-domain-monitor.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index 35d04b2..d9520ff 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -1384,17 +1384,22 @@ cmdDomTime(vshControl *ctl, const vshCmd *cmd) goto cleanup; =20 if (pretty) { - char timestr[100]; + char timestr[100], localtimestr[100]; time_t cur_time =3D seconds; - struct tm time_info; + struct tm time_info, local_time_info; =20 if (!gmtime_r(&cur_time, &time_info)) { vshError(ctl, _("Unable to format time")); goto cleanup; } + if (!localtime_r(&cur_time, &local_time_info)) { + vshError(ctl, _("Unable to format local time")); + goto cleanup; + } strftime(timestr, sizeof(timestr), "%Y-%m-%d %H:%M:%S", &time_= info); + strftime(localtimestr, sizeof(localtimestr), "%Y-%m-%d %H:%M:%= S", &local_time_info); =20 - vshPrint(ctl, _("Time: %s"), timestr); + vshPrint(ctl, _("Time: %s\n Local time: %s"), timestr, localti= mestr); } else { vshPrint(ctl, _("Time: %lld"), seconds); } --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list