From 9746d495303f3bf77ffe1bad60d8c85aa5b6df40 Mon Sep 17 00:00:00 2001 From: Andreas Neue Date: Thu, 29 Aug 2019 16:35:50 +0200 Subject: [PATCH] dont hardcode time offset in fuzzytime.go, set correct timezone in Dockerfile --- Dockerfile | 3 ++- modules/fuzzytime.go | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index bb81ff2..c68bfff 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,8 @@ FROM golang:latest MAINTAINER Andreas Neue -RUN apt -y update && apt -y upgrade && apt-get install -y fortune vim ca-certificates && apt-get clean +RUN apt -y update && apt -y upgrade && apt-get install -y fortune vim tzdata ca-certificates && apt-get clean +RUN ln -fs /usr/share/zoneinfo/Europe/Berlin /etc/localtime && dpkg-reconfigure -f noninteractive tzdata WORKDIR /go/src/flokati COPY . . diff --git a/modules/fuzzytime.go b/modules/fuzzytime.go index 02802f7..50d59f8 100644 --- a/modules/fuzzytime.go +++ b/modules/fuzzytime.go @@ -29,8 +29,8 @@ func fuzzytimeHandleMessage(m *Message) { func fuzzytimeShow(channel string) { t := time.Now() h := t.Hour() - tzcorrect := 1 - h = h + tzcorrect // XXX: This should not be hardcoded + z, o := t.Zone() + h = h + o m := t.Minute() s := "Es ist " switch {