aboutsummaryrefslogtreecommitdiff
path: root/block/qapi.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2021-06-14 15:59:13 +0100
committerPeter Maydell <peter.maydell@linaro.org>2021-06-14 15:59:13 +0100
commit1ea06abceec61b6f3ab33dadb0510b6e09fb61e2 (patch)
tree4b76a98d9104f81de9d8b337e470eacd1e04dfe5 /block/qapi.c
parentfbe7919ecee8d525ccd107027d73d877cd4eccc4 (diff)
parent970bc16f60937bcfd334f14c614bd4407c247961 (diff)
downloadqemu-1ea06abceec61b6f3ab33dadb0510b6e09fb61e2.zip
qemu-1ea06abceec61b6f3ab33dadb0510b6e09fb61e2.tar.gz
qemu-1ea06abceec61b6f3ab33dadb0510b6e09fb61e2.tar.bz2
Merge remote-tracking branch 'remotes/berrange-gitlab/tags/misc-fixes-pull-request' into staging
Merge misc patches # gpg: Signature made Mon 14 Jun 2021 15:14:48 BST # gpg: using RSA key DAF3A6FDB26B62912D0E8E3FBE86EBB415104FDF # gpg: Good signature from "Daniel P. Berrange <dan@berrange.com>" [full] # gpg: aka "Daniel P. Berrange <berrange@redhat.com>" [full] # Primary key fingerprint: DAF3 A6FD B26B 6291 2D0E 8E3F BE86 EBB4 1510 4FDF * remotes/berrange-gitlab/tags/misc-fixes-pull-request: usb/dev-mtp: use GDateTime for formatting timestamp for objects block: use GDateTime for formatting timestamp when dumping snapshot info migration: use GDateTime for formatting timestamp in snapshot names block: remove duplicate trace.h include block: add trace point when fdatasync fails block: preserve errno from fdatasync failures softmmu: add trace point when bdrv_flush_all fails migration: add trace point when vm_stop_force_state fails sasl: remove comment about obsolete kerberos versions docs: recommend SCRAM-SHA-256 SASL mech instead of SHA-1 variant docs: document usage of the authorization framework docs: document how to pass secret data to QEMU docs: add table of contents to QAPI references Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'block/qapi.c')
-rw-r--r--block/qapi.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/block/qapi.c b/block/qapi.c
index dc69341..cf557e3 100644
--- a/block/qapi.c
+++ b/block/qapi.c
@@ -663,10 +663,8 @@ BlockStatsList *qmp_query_blockstats(bool has_query_nodes,
void bdrv_snapshot_dump(QEMUSnapshotInfo *sn)
{
- char date_buf[128], clock_buf[128];
+ char clock_buf[128];
char icount_buf[128] = {0};
- struct tm tm;
- time_t ti;
int64_t secs;
char *sizing = NULL;
@@ -674,10 +672,9 @@ void bdrv_snapshot_dump(QEMUSnapshotInfo *sn)
qemu_printf("%-10s%-17s%8s%20s%13s%11s",
"ID", "TAG", "VM SIZE", "DATE", "VM CLOCK", "ICOUNT");
} else {
- ti = sn->date_sec;
- localtime_r(&ti, &tm);
- strftime(date_buf, sizeof(date_buf),
- "%Y-%m-%d %H:%M:%S", &tm);
+ g_autoptr(GDateTime) date = g_date_time_new_from_unix_local(sn->date_sec);
+ g_autofree char *date_buf = g_date_time_format(date, "%Y-%m-%d %H:%M:%S");
+
secs = sn->vm_clock_nsec / 1000000000;
snprintf(clock_buf, sizeof(clock_buf),
"%02d:%02d:%02d.%03d",