Browse Source

Merge pull request #831 from prometheus/fix-time-utc

Switch human-readable times to UTC.
pull/832/head
Julius Volz 10 years ago
parent
commit
9d7fa930ce
  1. 2
      template/template.go
  2. 2
      template/template_test.go
  3. 2
      web/blob/templates/alerts.html
  4. 2
      web/blob/templates/status.html

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

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

2
web/blob/templates/alerts.html

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

2
web/blob/templates/status.html

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

Loading…
Cancel
Save