|
Boost : |
From: Claus Tondering (claus.tondering_at_[hidden])
Date: 2003-09-25 05:23:58
The Boost date_time source code kindly refers to my Calendar FAQ
document.
I have a few comments in this connection:
1) In boost/date_time/gregorian_calendar.ipp I would appreciate it if
you would spell my name correctly (it's Tondering, not Todering).
2) In the same file you use an algorithm for calculating the ISO week
number found in the April 2000 version of the Calendar FAQ. You
have, however, made an error when translating the algorithm from
English into C++:
In the function ...::week_number(const ymd_type& ymd), this code:
else if (day != 5) {
return 1; //monday - thursday is in week 1 of next year
}
should be replaced with this code:
else {
return 1; //monday - wednesday is in week 1 of next year
}
(The current Boost algorithm returns a week number of 53 for
2003-12-29. But the correct value is 1.)
3) Incidentally, newer versions of the Calendar FAQ contain a better
algorithm for calculating the week number:
d4 = (J+31741 - (J % 7)) % 146097 % 36524 % 1461;
L = d4/1460;
d1 = ((d4-L) % 365) + L;
WeekNumber = d1/7+1;
where J is the Julian Day Number. (All variables are integers.)
4) In libs/date_time/doc/References.html you should use this URL for
the Calendar FAQ:
http://www.tondering.dk/claus/calendar.html
-- Claus Tondering, Lyngby, Denmark Email: claus_at_[hidden]
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk