From 83c41cebd92d04b27a4dcff7a44232ef200f6a65 Mon Sep 17 00:00:00 2001 From: Laine Stump Date: Sun, 1 Jun 2014 05:21:19 +0300 Subject: [PATCH] util: fix DST end date in virtimetest timezones Reported by: Roman Bogorodskiy Some of the tests for virTimeLocalOffsetFromUTC set an imaginary timezone that attempts to force dyalight savings time active all the time by setting a start date of 0/00:00:00 and end date of 366/23:59:59. Since the day is 0-based, 366 really means "day 367" which will never occur - this was an attempt to eliminate problems with DST not being active in some cases right around midnight on January 1. Even though it didn't completely solve the problem, it didn't seem to cause harm so it was left in the test timezones. Although Linux glibc doesn't mind having a DST end date of 366, FreeBSD refuses to use such timezones, so the tests fail. This patch changes the 366 to 365. This may or may not cause failure of the remaining DST tests around midnight Jan 1. If so, we will need to disable those tests at year's end too. --- tests/virtimetest.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/virtimetest.c b/tests/virtimetest.c index 749a112269..859bd13fad 100644 --- a/tests/virtimetest.c +++ b/tests/virtimetest.c @@ -192,13 +192,13 @@ mymain(void) * have DST in effect; what's more, cover a zone with * with an unusual DST different than a usual one hour */ - TEST_LOCALOFFSET("VIR-00:30VID,0/00:00:00,366/23:59:59", + TEST_LOCALOFFSET("VIR-00:30VID,0/00:00:00,365/23:59:59", ((1 * 60) + 30) * 60); - TEST_LOCALOFFSET("VIR-02:30VID,0/00:00:00,366/23:59:59", + TEST_LOCALOFFSET("VIR-02:30VID,0/00:00:00,365/23:59:59", ((3 * 60) + 30) * 60); - TEST_LOCALOFFSET("VIR-02:30VID-04:30,0/00:00:00,366/23:59:59", + TEST_LOCALOFFSET("VIR-02:30VID-04:30,0/00:00:00,365/23:59:59", ((4 * 60) + 30) * 60); - TEST_LOCALOFFSET("VIR-12:00VID-13:00,0/00:00:00,366/23:59:59", + TEST_LOCALOFFSET("VIR-12:00VID-13:00,0/00:00:00,365/23:59:59", ((13 * 60) + 0) * 60); if (!isNearYearEnd()) { @@ -214,11 +214,11 @@ mymain(void) * tests, except on Dec 31 and Jan 1. */ - TEST_LOCALOFFSET("VIR02:45VID00:45,0/00:00:00,366/23:59:59", + TEST_LOCALOFFSET("VIR02:45VID00:45,0/00:00:00,365/23:59:59", -45 * 60); - TEST_LOCALOFFSET("VIR05:00VID04:00,0/00:00:00,366/23:59:59", + TEST_LOCALOFFSET("VIR05:00VID04:00,0/00:00:00,365/23:59:59", ((-4 * 60) + 0) * 60); - TEST_LOCALOFFSET("VIR11:00VID10:00,0/00:00:00,366/23:59:59", + TEST_LOCALOFFSET("VIR11:00VID10:00,0/00:00:00,365/23:59:59", ((-10 * 60) + 0) * 60); }