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

Switch human-readable times to UTC.
This commit is contained in:
Julius Volz 2015-06-23 21:26:56 +02:00
commit 9d7fa930ce
4 changed files with 4 additions and 4 deletions

View File

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

View File

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

View File

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

View File

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