scummvm/scummvm — pull request #249 by digitall (2012-06-18 19:29:06+00:00)
Title: PS2: Implement algorithm for day of week for use in tm_wday.

This implements an algorithm to supply day of the week for the PS2 backend by calculation from Y/M/D values, as the platform RTC and/or structures exposed do not provide this information.

Since I don't have a PS2, I have not been able to compile or test this, but it should be fine.
However, I have tested the algorithm seperately and it looks correct.

After this fix is merged, we should look at moving this algorithm up to the common code function i.e. rather than having this functionality duplicated over various backends in varying ways, we should look at having the backend returned structure place say -1 in the field if there is no H/W / platform API for "day of the week", which then invokes this algorithm to replace the value before the engine/base code gets the Time/Date structure. Otherwise, the value supplied by the platform API is used.