Switch human-readable times to UTC.

This fixes https://github.com/prometheus/prometheus/issues/829
pull/831/head
Julius Volz 10 years ago
parent cc18191b5e
commit bbc8b8490e

@ -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 {

@ -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.

@ -37,7 +37,7 @@
{{end}}
</td>
<td><span class="alert alert-{{ .State | alertStateToClass }} state_indicator">{{.State}}</span></td>
<td>{{.ActiveSince.Time}}</td>
<td>{{.ActiveSince.Time.UTC}}</td>
<td>{{.Value}}</td>
<td><a href="#" class="silence_alert_link">Silence&hellip;</a></td>
</tr>

@ -7,7 +7,7 @@
<tbody>
<tr>
<th>Uptime</th>
<td>{{.Status.Birth}}</td>
<td>{{.Status.Birth.UTC}}</td>
</tr>
</tbody>
</table>

Loading…
Cancel
Save