From bbc8b8490ed41a5c718512181ed03e3223f98c24 Mon Sep 17 00:00:00 2001 From: Julius Volz Date: Tue, 23 Jun 2015 21:15:32 +0200 Subject: [PATCH] Switch human-readable times to UTC. This fixes https://github.com/prometheus/prometheus/issues/829 --- template/template.go | 2 +- template/template_test.go | 2 +- web/blob/templates/alerts.html | 2 +- web/blob/templates/status.html | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/template/template.go b/template/template.go index 7b7cdd267..dc2aca98c 100644 --- a/template/template.go +++ b/template/template.go @@ -242,7 +242,7 @@ func NewTemplateExpander(text string, name string, data interface{}, timestamp c if math.IsNaN(v) || math.IsInf(v, 0) { return fmt.Sprintf("%.4g", v) } - t := clientmodel.TimestampFromUnixNano(int64(v * 1000000000)).Time() + t := clientmodel.TimestampFromUnixNano(int64(v * 1e9)).Time().UTC() return fmt.Sprint(t) }, "pathPrefix": func() string { diff --git a/template/template_test.go b/template/template_test.go index b3a92bc53..b096a8134 100644 --- a/template/template_test.go +++ b/template/template_test.go @@ -142,7 +142,7 @@ func TestTemplateExpansion(t *testing.T) { { // HumanizeTimestamp - clientmodel.SampleValue input. text: "{{ 1435065584.128 | humanizeTimestamp }}", - output: "2015-06-23 15:19:44.128 +0200 CEST", + output: "2015-06-23 13:19:44.128 +0000 UTC", }, { // Title. diff --git a/web/blob/templates/alerts.html b/web/blob/templates/alerts.html index bc9015dde..aa97b336e 100644 --- a/web/blob/templates/alerts.html +++ b/web/blob/templates/alerts.html @@ -37,7 +37,7 @@ {{end}} {{.State}} - {{.ActiveSince.Time}} + {{.ActiveSince.Time.UTC}} {{.Value}} Silence… diff --git a/web/blob/templates/status.html b/web/blob/templates/status.html index 69678a32d..ed50c9d63 100644 --- a/web/blob/templates/status.html +++ b/web/blob/templates/status.html @@ -7,7 +7,7 @@ Uptime - {{.Status.Birth}} + {{.Status.Birth.UTC}}