]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Fix funny off-by-one error in clock-variable
authorDan Kenigsberg <danken@redhat.com>
Mon, 6 Dec 2010 07:59:30 +0000 (09:59 +0200)
committerEric Blake <eblake@redhat.com>
Mon, 6 Dec 2010 18:14:42 +0000 (11:14 -0700)
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

index 925585a1fb9141cc9ab9296d9616f954dc6282cc..3e47e4f97f3101691ddb631a326b5c559a877bc1 100644 (file)
@@ -3710,9 +3710,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-%02d-%02dT%02d:%02d:%02d",
                           nowbits.tm_year + 1900,
-                          nowbits.tm_mon,
+                          nowbits.tm_mon + 1,
                           nowbits.tm_mday,
                           nowbits.tm_hour,
                           nowbits.tm_min,