]> xenbits.xensource.com Git - libvirt.git/commitdiff
util: fix DST end date in virtimetest timezones
authorLaine Stump <laine@laine.org>
Sun, 1 Jun 2014 02:21:19 +0000 (05:21 +0300)
committerLaine Stump <laine@laine.org>
Sun, 1 Jun 2014 02:21:19 +0000 (05:21 +0300)
Reported by: Roman Bogorodskiy <bogorodskiy@gmail.com>

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

index 749a112269e4f5383b3bda69461ef12d9a1fabb7..859bd13fad5da3a61105302476af0e5692fa29a5 100644 (file)
@@ -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);
     }