]> code.delx.au - comingnext/commitdiff
Workaround for Nokia firmware bug
authorJames Bunton <jamesbunton@delx.net.au>
Fri, 5 Oct 2012 11:43:01 +0000 (21:43 +1000)
committerJames Bunton <jamesbunton@delx.net.au>
Fri, 5 Oct 2012 12:13:25 +0000 (22:13 +1000)
comingNext/index.html

index a11e029f1514f01257f6b66dad75a0b36c394d7c..812ae7f69e6984e039bfd4960b0b165c7f80db05 100644 (file)
@@ -113,6 +113,7 @@ var statupSuccessful = false; // indicates if everything started up wihtout erro
 var use12hoursTimeFormat = false; // defines how time should be formated: 19:00 or 07:00 pm\r
 var timeFormatSeparator = ":"; // format time 19:00 or 19.00 depending on system setting\r
 var defaultFontSize = null; // default browser font size will be set by init\r
+var displayOffset = 0;\r
 \r
 // vars for daylight saving time\r
 var summertime = false; // true, if current date is in summer, false if in winter\r
@@ -531,6 +532,9 @@ function parseDate(dateString)
                        log('parseDate(): fixing time +1h: ' + result);\r
                }\r
        }\r
+       if (displayOffset != 0) {\r
+               result = new Date(result.getTime() + displayOffset);\r
+       }\r
 \r
        return result;\r
 }\r
@@ -1043,6 +1047,7 @@ function init()
        else {\r
                mode = 1;\r
        }\r
+       checkForOffByOneBug();\r
        log("init(): updateScreen()");\r
        updateScreen();\r
        if (config['useBackgroundImage'].Value)\r
@@ -1057,6 +1062,17 @@ function init()
                statupSuccessful = true;\r
 }\r
 \r
+function checkForOffByOneBug() {\r
+       var tz = new Date().getTimezoneOffset();\r
+       if (tz < 0) {\r
+               tz = -tz;\r
+       }\r
+       tz = tz / 60;\r
+       if (tz > 12) {\r
+               displayOffset = 24*3600*1000;\r
+       }\r
+}\r
+\r
 function checkOrientation()\r
 {\r
        //updateScreen();\r