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) { if math.IsNaN(v) || math.IsInf(v, 0) {
return fmt.Sprintf("%.4g", v) return fmt.Sprintf("%.4g", v)
} }
t := clientmodel.TimestampFromUnixNano(int64(v * 1000000000)).Time() t := clientmodel.TimestampFromUnixNano(int64(v * 1e9)).Time().UTC()
return fmt.Sprint(t) return fmt.Sprint(t)
}, },
"pathPrefix": func() string { "pathPrefix": func() string {

@ -142,7 +142,7 @@ func TestTemplateExpansion(t *testing.T) {
{ {
// HumanizeTimestamp - clientmodel.SampleValue input. // HumanizeTimestamp - clientmodel.SampleValue input.
text: "{{ 1435065584.128 | humanizeTimestamp }}", 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. // Title.

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

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

Loading…
Cancel
Save