[Xymon] Bug in holidays calculation
J.C. Cleaver
cleaver at terabithia.org
Wed Feb 3 23:29:57 CET 2016
On Tue, February 2, 2016 1:34 pm, Tom Schmidt (tschmidt) wrote:
> I have noticed a bug in the holidays feature of Xymon. I am using Xymon
> 4.3.24 and have seen it on previous releases as well. The issue is that
> the US Holiday of Thanksgiving is not showing the correct date during
> leap years. Thanksgiving is the fourth Thursday in November, so is
> using this entry in holidays.cfg:
>
> Thanksgiving:type=thu month=11 offset=4
>
> This works correctly during non-leap years, but it is a day off during
> leap years like 2016. I added these simple entries to holidays.cfg to
> better show the issue:
>
> November Week 1 Thu:type=thu month=11 offset=1
> November Week 2 Thu:type=thu month=11 offset=2
> November Week 3 Thu:type=thu month=11 offset=3
>
> When I look at the holidays that it calculates, I get this in the info
> column:
>
> Holidays 2015/2016 (USA)
> November Week 1 Thu Nov 05
> November Week 2 Thu Nov 12
> November Week 3 Thu Nov 19
> Thanksgiving Nov 26
> Christmas Day Dec 25
> New Year's Day Jan 01
> Easter Sunday Mar 27
> Memorial Day May 30
> Independence Day Jul 04
> Labor Day Sep 05
> November Week 1 Thu Nov 03
> November Week 2 Thu Nov 09
> November Week 3 Thu Nov 16
> Thanksgiving Nov 23
>
> Note that the November 2015 dates are correct, but the November 2016
> dates for Week 2 and later are a day early. Thus it thinks Thanksgiving
> 2016 is on November 23 instead of the correct November 24 date.
>
> I looked at the source code some, but I could not follow the logic of
> how it is calculating this date incorrectly. It is a minor bug only
> affecting those that use the holidays feature for alerts or look at the
> holidays table in the info tab. Can someone figure out why it is not
> calculating the date offsets correctly? It only seems to be doing this
> during leap years.
>
> Thanks...Tom
Hi,
This is definitely a bug in the holidays code; I think the *1st* X of the
month is being calculated OK, but others aren't... Unfortunately, my eyes
began to glaze over the further I got into mktime() response parsing :/
Looks like we had this issue four years ago too:
http://lists.xymon.com/archive/2012-January/033507.html
I'll see if I can take a closer look later on.
Regards,
-jc
More information about the Xymon
mailing list