Patch level : 4.0
Files correlati : mr Ricompilazione Demo : [ ] Commento : Corretto calcolo della Pasqua (serve solo al calendario MRP) git-svn-id: svn://10.65.10.50/trunk@15397 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
e3ff823767
commit
b519bd5343
@ -377,27 +377,26 @@ int TDate::week() const
|
||||
return int((*this - y) / 7 + 1);
|
||||
}
|
||||
|
||||
// Calcola la Pasqua per gli anni compresi tra 1900 e 2200
|
||||
void TDate::set_easter(int n)
|
||||
{
|
||||
if (n > 0)
|
||||
set_year(n);
|
||||
const int y = n > 0 ? n : year();
|
||||
const int correction = y < 2100 ? 0 : 1; // Semplificazione tabella dal 1600 al 2500
|
||||
int d = (19 * (y%19) + 24) % 30;
|
||||
d += 22 + ((2*(y%4) + 4*(y%7) + 6*d + 5 + correction) % 7);
|
||||
|
||||
const int y = year();
|
||||
const int g = y % 19;
|
||||
const int c = y / 200;
|
||||
const int h = (c - c / 4 - (8 * c + 13) / 25 + 19 * g+ 15) % 30;
|
||||
const int i = h - (h / 28) * (1 - (29 / (h + 1)) * ((21 - g) / 11));
|
||||
const int j = (y + y / 4 + i + 2 - c + c / 4) % 7;
|
||||
const int l = i - j;
|
||||
const int m = 3 + (l + 40) / 44;
|
||||
set_month(m);
|
||||
const int d = l + 28 - 31 * (m / 4);
|
||||
set_day(d);
|
||||
int m = 3;
|
||||
if (d > 31)
|
||||
{
|
||||
d -= 31;
|
||||
m++;
|
||||
}
|
||||
_val = makedata(d, m, y);
|
||||
}
|
||||
|
||||
bool TDate::is_holiday() const
|
||||
{
|
||||
if (wday() > 5) // Week-end
|
||||
if (wday() == 7) // Domenica
|
||||
return true;
|
||||
const int d = day();
|
||||
const int m = month();
|
||||
|
Loading…
x
Reference in New Issue
Block a user