提交 51bea5df 编写于 作者: M Michal Privoznik

qemuBuildClockArgStr: Allow localtime clock basis

https://bugzilla.redhat.com/show_bug.cgi?id=1046192

Commit b8bf79aa, which adds clock='variable', forgets to check
localtime basis in qemuBuildClockArgStr(). So that localtime
basis could not be used.
Reported-by: NJincheng Miao <jmiao@redhat.com>
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
上级 0db9b088
......@@ -6491,14 +6491,18 @@ qemuBuildClockArgStr(virDomainClockDefPtr def)
time_t now = time(NULL);
struct tm nowbits;
if (def->data.variable.basis != VIR_DOMAIN_CLOCK_BASIS_UTC) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unsupported clock basis '%s'"),
virDomainClockBasisTypeToString(def->data.variable.basis));
goto error;
switch ((enum virDomainClockBasis) def->data.variable.basis) {
case VIR_DOMAIN_CLOCK_BASIS_UTC:
now += def->data.variable.adjustment;
gmtime_r(&now, &nowbits);
break;
case VIR_DOMAIN_CLOCK_BASIS_LOCALTIME:
now += def->data.variable.adjustment;
localtime_r(&now, &nowbits);
break;
case VIR_DOMAIN_CLOCK_BASIS_LAST:
break;
}
now += def->data.variable.adjustment;
gmtime_r(&now, &nowbits);
/* Store the guest's basedate */
def->data.variable.basedate = now;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册