Contributing Advent 9: Day of the week
This is another one in the Date/Time extension series. Bugs #63391 and #61599 both deal with PHP getting the Day of Week wrong in years before 1600. Technically I did not write the patch for this contribution, but I did add tests, verified it and merged it to all the four branches (PHP 5.4, 5.5, 5.6 and master).
However, it does seem that I introduced the bug in the first place. When writing the new date/time support about 7 years ago I was looking for an algorithm that would tell me the day of the week for any given (Gregorian calendar) date. Wikipedia has quite a good article on it. The article outlines the calculation of the century number. For the Gregorian calendar, that's quite straight forwards: 6 - (j % 4) * 2. For the Julian calendar it's not very difficult either. Although PHP uses the proleptic Gregorian calendar that I wrote about before, I mistakenly had used a formula that combined the Julian and Gregorian calendar calculations. This then resulted in wrong calculations before the year 1600. This is now corrected and ready for inclusion into PHP 5.4.24, 5.5.7, and later versions.
Life Line
What the United States and Israel are doing to Iran is undistinguishable from Russia is doing to Ukraine.
Created 8 waste_baskets, 7 benches, and 5 other objects
The Early Bird Catches the Worm
Updated a pub
Created 3 recyclings, 3 waste_baskets, and 2 other objects
I walked 3.4km in 56m37s
Updates from walk
🐰🥚 Two bunnies lazing about, tired from hiding all the chocolate eggs.
Created a bench; Updated a bus_stop
I walked 1.7km in 28m08s
Updated 2 bus_stops
Created a telephone; Updated a cafe and a toilet; Deleted a kiosk shop and a toilet; Confirmed an atm
Updated a bench
Updated a restaurant
I hiked 17.3km in 3h37m57s
Updated a restaurant
I walked 9.6km in 2h5m58s
I walked 7.2km in 1h10m18s
Updated a pet_grooming shop; Deleted a dry_cleaning shop; Confirmed 2 variety_store shops, a fitness_centre, and a convenience shop
I walked 4.1km in 47m50s
I walked 1.2km in 9m08s
Map new layout of Meanwhile Gardens
I walked 10.4km in 1h45m58s
This is probably the shortest chapter I've ever read in any book. And it'll likely stay like that.





Shortlink
This article has a short URL available: https://drck.me/adv1309-af1