2 * Copyright 2010, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
17 virtual ~BHoliday() { };
21 class BEasterHoliday
: public BHoliday
{
23 static BDate
EasterSunday(int32 year
);
24 static BDate
AscensionDay(int32 year
);
25 static BDate
PentecostDay(int32 year
);
30 Returns the date for easter sunday for the \c year.
33 BEasterHoliday::EasterSunday(int32 year
)
35 // http://bloggingabout.net/blogs/jschreuder/archive/2005/06/24/7019.aspx
36 int32 gold
= year
% 19;
37 int32 century
= year
/ 100;
38 int32 h
= (century
- (int32
)(century
/ 4)
39 - (int32
)((century
* 8 + 13) / 25) + 19 * gold
+ 15) % 30;
40 int32 i
= h
- (int32
)(h
/ 28) * (1 - (int32
)(h
/ 28)
41 * (int32
)(29 / (h
+ 1)) * (int32
)((21 - gold
) / 11));
43 int32 day
= i
- ((year
+ (int32
)(year
/ 4) + i
+ 2 - century
44 + (int32
)(century
/ 4)) % 7) + 28;
47 date
.SetDate(year
, 4, day
- 31);
49 date
.SetDate(year
, 3, day
);
55 Returns the date for ascension day for the \c year.
58 BEasterHoliday::AscensionDay(int32 year
)
60 BDate date
= EasterSunday(year
);
67 Returns the date for pentecost day for the \c year.
70 BEasterHoliday::PentecostDay(int32 year
)
72 BDate date
= EasterSunday(year
);
78 } // namespace BPrivate
81 using BPrivate::BHoliday
;
82 using BPrivate::BEasterHoliday
;