[PATCH] Fix funny off-by-one error in clock-variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Humans consider January as month #1, while gmtime_r(3) calls it month #0.

While fixing it, render qemu's rtc parameter with leading zeros, as is more
commonplace.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=660194
---
 src/qemu/qemu_conf.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 83c0f83..973e95b 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -3510,9 +3510,9 @@ qemuBuildClockArgStr(virDomainClockDefPtr def)
         now += def->data.adjustment;
         gmtime_r(&now, &nowbits);
 
-        virBufferVSprintf(&buf, "base=%d-%d-%dT%d:%d:%d",
+        virBufferVSprintf(&buf, "base=%d-%d-%dT%02d:%02d:%02d",
                           nowbits.tm_year + 1900,
-                          nowbits.tm_mon,
+                          nowbits.tm_mon + 1,
                           nowbits.tm_mday,
                           nowbits.tm_hour,
                           nowbits.tm_min,
-- 
1.7.3.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]