From 049734f8a321cdc851f392366969c65c2f695927 Mon Sep 17 00:00:00 2001 From: Chteufleur Date: Mon, 28 Sep 2015 22:20:13 +0200 Subject: [PATCH] Fixe GMT bug in graph --- controllers/viewTemp.go | 7 ++++++- views/temp.tpl | 3 +-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/controllers/viewTemp.go b/controllers/viewTemp.go index 8381042..4f833e4 100644 --- a/controllers/viewTemp.go +++ b/controllers/viewTemp.go @@ -8,6 +8,11 @@ import ( "html/template" "strconv" + "time" +) + +var ( + _, timezoneOffset = time.Now().Zone() ) type ViewTempController struct { @@ -49,7 +54,7 @@ func formatDataSensor(sensorName string, values []temperature.TempTable) string if i > 0 { ret += "," } - horodate := strconv.FormatInt(values[i].HorodateGMT.Unix() * 1000, 10) + horodate := strconv.FormatInt((values[i].HorodateGMT.Unix()+int64(timezoneOffset)) * 1000, 10) value := strconv.FormatInt(values[i].Value, 10) ret += "["+horodate+","+value+"]" } diff --git a/views/temp.tpl b/views/temp.tpl index b59fa3c..918daca 100644 --- a/views/temp.tpl +++ b/views/temp.tpl @@ -58,8 +58,7 @@ }); Highcharts.setOptions({ global: { - useUTC: true, - timezoneOffset: -4 * 60 + useUTC: false } });