var cold_d = [], hot_d = [];
function showdate(utime) {
var cold_d = [], hot_d = [];
function showdate(utime) {
const mn = ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
const mn = ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
- var inc, inc2, base, t, dt;
+ var inc, inc2, base, base2, t, dt, zoff;
var label = function(t) { return "<<" + t.toFixed(1) + ">>"; }
function tohour(t) { var dt = new Date(t*1000); return dt.getHours(); }
function todow(t) { var dt = new Date(t*1000); return dow[dt.getDay()]; }
var label = function(t) { return "<<" + t.toFixed(1) + ">>"; }
function tohour(t) { var dt = new Date(t*1000); return dt.getHours(); }
function todow(t) { var dt = new Date(t*1000); return dow[dt.getDay()]; }
- base = (Math.floor(tmin / inc2) + 1) * inc2 + 60 * dt.getTimezoneOffset();
- for (t = base; t < tmax; t += inc2)
+ base2 = (Math.floor((tmin - zoff - 1) / inc2) + 1) * inc2 + zoff;
+ for (t = base2; t < tmax; t += inc2)
- //dbg.innerHTML = "ord=" + ord + "<br>inc=" + inc + "<br>"
+ //dbg.innerHTML = "inc=" + inc + "<br>inc2=" + inc2 + "<br>"
+ // + "tmin=" + tmin + " tmax=" + tmax + "<br>"
+ // + "base=" + base + " base2=" + base2 + "<br>"
- document.getElementById("totcold").innerHTML =
- ((data.cold[data.cold.length - 1][1] - data.cold[0][1]) * 10);
- document.getElementById("tothot").innerHTML =
- ((data.hot[data.hot.length - 1][1] - data.hot[0][1]) * 10);
+ if (data.cold.length)
+ document.getElementById("totcold").innerHTML =
+ ((data.cold[data.cold.length - 1][1] - data.cold[0][1]) * 10);
+ else document.getElementById("totcold").innerHTML = "0";
+ if (data.hot.length)
+ document.getElementById("tothot").innerHTML =
+ ((data.hot[data.hot.length - 1][1] - data.hot[0][1]) * 10);
+ else document.getElementById("tothot").innerHTML = "0";