[Bug 201062] Calendar did not show Father's day on June 22, 2015 using calendar.usholiday
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Mon Jun 22 23:58:48 UTC 2015
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=201062
Bug ID: 201062
Summary: Calendar did not show Father's day on June 22, 2015
using calendar.usholiday
Product: Base System
Version: 10.1-STABLE
Hardware: amd64
OS: Any
Status: New
Severity: Affects Some People
Priority: ---
Component: bin
Assignee: freebsd-bugs at FreeBSD.org
Reporter: comet.berkeley at gmail.com
Created attachment 158000
--> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=158000&action=edit
Calendar Father's Day patch
The calendar.usholiday file contains 42 lines of which 2 are relevant to June
21, 2015:
06/SunThird Father's Day (3rd Sunday of June)
06/21* Summer Solstice
My .calendar/calendar file includes this one line:
#include <calendar.usholiday>
And when calendar runs it should show two lines out, one for Father's Day and
one for the Solstice:
$calendar -t21.6.2015
Jun 21* Summer Solstice
I patched the code (calendar.c and parsedata.c) and the problem seems to be
fixed.
$calendar -t21.6.2015
Jun 21* Summer Solstice
Jun 21* Father's Day (3rd Sunday of June)
To debug this it was helpful to set the debug_remember flag in
the dates.c code. This flag is a global integer and can be set from calendar.c
when the -d option (debug) is set.
In parsedata.c, the calculation of the first day of the recurring weekdays is
wrong as it is trying to calculate a day of the month but will always return an
integer in the range 0-6. 0 is always wrong...
It was:
d = (idayofweek - dow + 8) % 7;
But should be:
d = (idayofweek - dow + 7) % 7 + 1;
Additionally the variable dow can be -1 and when it is the code should probably
stop (continue) so a better patch is this:
if (dow < 0)
continue;
d = (idayofweek - dow + 7) % 7 + 1;
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-bugs
mailing list