Fix bug on print horodate on index page

This commit is contained in:
Chteufleur 2015-09-29 21:36:27 +02:00
parent 6c03e63e62
commit 466b7060d8
2 changed files with 11 additions and 5 deletions

View File

@ -7,8 +7,14 @@ import (
"datahouse/models/temperature"
"strconv"
"time"
)
var (
_, timezoneOffset = time.Now().Zone()
)
type SensorPrint struct {
Name string
Value string
@ -41,7 +47,10 @@ func getLastTemps() ([]SensorPrint) {
sens.Value = strconv.FormatInt(t.Value, 10)
sens.Unit = "°C"
sens.Horodate = t.HorodateGMT.Format("04h05")
horodatTmp := t.HorodateGMT
horodatTmp = horodatTmp.Add(time.Duration(timezoneOffset)*time.Second)
h, m, _ := horodatTmp.Clock()
sens.Horodate = strconv.Itoa(h)+"h"+strconv.Itoa(m)
values = append(values, *sens)
}

View File

@ -8,12 +8,9 @@ import (
"html/template"
"strconv"
"time"
)
var (
_, timezoneOffset = time.Now().Zone()
)
type ViewTempController struct {
beego.Controller