News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

ISO week numbers

Started by andershz, April 12, 2012, 10:15:33 AM

Previous topic - Next topic

andershz

Quote from: MrPhil on April 19, 2012, 03:59:13 PM
Very strange. Assuming $curTimestamp is a signed 32 bit integer, its current value should be around 1.3E+09, so adding 1 week's worth of seconds shouldn't overflow anything (nor force a change to floating point and possible loss of precision). The $curTimestamp is at midnight (00:00:00), so $nexWeekTimestamp should have exactly the same value either way.
The issue is not overflow, but rather that always adding 604800 seconds doesn't take possible daylight savings time into account.
Quote from: MrPhil on April 19, 2012, 03:59:13 PM
Have you confirmed that your change handles end-of-month wraparound OK (e.g., April 33rd)? According to the mktime() reference, it should, but in practice who knows?
Not for every possible date, but for a few selected ones, and it does indeed work.
Quote from: MrPhil on April 19, 2012, 03:59:13 PM
I don't see %V being used in standard SMF code. Is it only used by a mod?
Probably only by the first version of this mod.
I also believed that %V worked everywhere until bdzpete pointed out that it didn't work on his Windows box.

Advertisement: