commit b8bf79a, which add clock=variable, forgets to check localtime
basis in qemuBuildClockArgStr(). So that localtime basis could not
be used, like this bug:
https://bugzilla.redhat.com/show_bug.cgi?id=1046192
---
src/qemu/qemu_command.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index d723dc8..749ad54 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6490,15 +6490,21 @@ qemuBuildClockArgStr(virDomainClockDefPtr def)
time_t now = time(NULL);
struct tm nowbits;
- if (def->data.variable.basis != VIR_DOMAIN_CLOCK_BASIS_UTC) {
+ if (def->data.variable.basis == VIR_DOMAIN_CLOCK_BASIS_UTC) {
+ now += def->data.variable.adjustment;
+ gmtime_r(&now, &nowbits);
+ }
+ else if (def->data.variable.basis == VIR_DOMAIN_CLOCK_BASIS_LOCALTIME) {
+ now += def->data.variable.adjustment;
+ localtime_r(&now, &nowbits);
+ }
+ else {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unsupported clock basis '%s'"),
virDomainClockBasisTypeToString(def->data.variable.basis));
goto error;
}
- now += def->data.variable.adjustment;
- gmtime_r(&now, &nowbits);
-
+
/* Store the guest's basedate */
def->data.variable.basedate = now;
--
1.8.3.1