diff options
author | Derick Rethans <github@derickrethans.nl> | 2013-11-28 16:32:11 +0000 |
---|---|---|
committer | Derick Rethans <github@derickrethans.nl> | 2013-11-28 16:32:11 +0000 |
commit | d22cc5c816fdb6017ce9e22b4594d1566939e4ec (patch) | |
tree | 37e00b306bd733ae952c5e0406032dd3cdb9ab96 /ext/date/lib/dow.c | |
parent | c1eb219aad2e23db5db27d887b93b06c1537fec9 (diff) | |
download | php-git-d22cc5c816fdb6017ce9e22b4594d1566939e4ec.tar.gz |
Fixed bug #65199 (Wrong Day of Week) and fixed bug #63391 (Incorrect/inconsistent day of week prior to the year 1600)
Diffstat (limited to 'ext/date/lib/dow.c')
-rw-r--r-- | ext/date/lib/dow.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/ext/date/lib/dow.c b/ext/date/lib/dow.c index b6c2d69682..6c296a2ba8 100644 --- a/ext/date/lib/dow.c +++ b/ext/date/lib/dow.c @@ -25,10 +25,7 @@ static int m_table_leap[13] = { -1, 6, 2, 3, 6, 1, 4, 6, 2, 5, 0, 3, 5 }; /* 1 static timelib_sll century_value(timelib_sll j) { - timelib_sll i = j - 17; - timelib_sll c = (4 - i * 2 + (i + 1) / 4) % 7; - - return c < 0 ? c + 7 : c; + return 6 - (j % 4) * 2; } static timelib_sll timelib_day_of_week_ex(timelib_sll y, timelib_sll m, timelib_sll d, int iso) @@ -36,11 +33,8 @@ static timelib_sll timelib_day_of_week_ex(timelib_sll y, timelib_sll m, timelib_ timelib_sll c1, y1, m1, dow; /* Only valid for Gregorian calendar, commented out as we don't handle - * julian calendar. We just return the 'wrong' day of week to be - * consistent. - if (y < 1753) { - return -1; - } */ + * Julian calendar. We just return the 'wrong' day of week to be + * consistent. */ c1 = century_value(y / 100); y1 = (y % 100); m1 = timelib_is_leap(y) ? m_table_leap[m] : m_table_common[m]; |