]> www.average.org Git - pulsecounter.git/commitdiff
fix time interval selection
authorEugene Crosser <crosser@average.org>
Wed, 23 Dec 2015 18:11:32 +0000 (21:11 +0300)
committerEugene Crosser <crosser@average.org>
Wed, 23 Dec 2015 18:11:32 +0000 (21:11 +0300)
web/index.html
web/query.cgi

index 2041d70b022f2a21e8022f4fb4540d0eb4e8346e..51a8da9a035400579efabe26ea7f4cd7c156c57b 100644 (file)
   var xzero = 20, yzero = 20;
   var cold_d = [], hot_d = [];
 
+  function showdate(utime) {
+    var dt = new Date(utime*1000);
+    return dt.toLocaleDateString() + " " + dt.toLocaleTimeString();
+  }
+
   function getcomb(lo, hi) {
     var comb = [], lb = [];
     var d = hi - lo;
       (data.current.hot / 100).toFixed(2);
     tmin = data.range.lo;
     tmax = data.range.hi;
+    dbg.innerHTML = "from " + tmin + " to " + tmax
+                  + "<br>from " + showdate(tmin) + " to " + showdate(tmax);
     /* differetiate() updates hmax */
     hmax = 0;
     cold_d = differentiate(data.cold);
   }
 
   function sendquery(lo, hi) {
-    var url = "query.cgi" + "?lo=" + iso2qu(lo) + "&" + iso2qu(hi);
+    var url = "query.cgi" + "?lo=" + iso2qu(lo) + "&hi=" + iso2qu(hi);
 
     //dbg.innerHTML = url;
     xmlhttp.onreadystatechange = function() {
index 967127650427e5fda18d04e8a2b27d2bec937f7b..839f7885faf7ea19016e7b344762655314feb50c 100755 (executable)
@@ -30,6 +30,7 @@ cgiMain = do
                                               , connectPassword = pass conf
                                               , connectDatabase = dbnm conf
                                               }
+  _ <- liftIO $ execute_ conn "set time_zone = '+00:00';";
   today <- liftIO getClockTime
   let tomorrow = addToClockTime (noTimeDiff {tdDay = 1}) today
       daystart x = (toUTCTime x) { ctHour = 0, ctMin = 0