Stiti cu totii ca sistemul Do Not Disturb din iOS nu a functionat pentru foarte multi utilizatori in prima zi a acestui an, iar ieri v-am spus ca abia din 7 ianuarie il vom putea utiliza din nou. Apple nu a spus de ce a incetat sa functioneze corect sistemul, ne-a spus doar cand va reveni totul la normal, insa cei de la Macworld au o posibila explicatie. Ei sustin ca modul in care a fost gandit codul sursa al sistemului genereaza o problema de functionare in prima zi a unui an calendaristic, totul avand legatura cu modul in care a fost setata data folosind sistemul ISO.
Now, to programmers who’ve done a lot of work with date and time handling (like me; I write airline flight systems for a living, which require a lot of heavy timezone math) “it’s broken during something like the first week of the year” immediately suggests a moderately obscure problem related to the ISO week date. This is a slightly weird definition of the year that you get from many date manipulation libraries by specifying that you want the year as “YYYY”, as opposed to the more common “yyyy”.
So, for 2012, the 1st-6th of January will show as being part of 2012 if the developer specifies “YYYY” in his or her date string, rather than being part of 2013. This means that when DND automatically switches on, it will have a calculated switch off date of sometime in 2012, which is now in the past so it will never turn off. I once made this mistake in my own code, as it’s very easy to type “YYYY” instead of “yyyy”; it seems some nameless Apple engineer has done the same in iOS’s Do Not Disturb function, but only in the automatic switch off time, not the switch on time part. In my case, the problem was caught in automated testing and never went live. The Apple engineer has been less fortunate.
Intreaga explicatie o gasiti la Macworld, asta daca sunteti siguri ca o veti intelege si aveti in vreun fel nevoie de ea.
UPDATE: Cei de la Macworld sustin ca explicatiile lor sunt eronate, deci ignorati-le.