提交 83c41ceb 编写于 作者: L Laine Stump

util: fix DST end date in virtimetest timezones

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.
上级 c7ca02e6
......@@ -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);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册