Convert os time and timezone from WMI to native go

Signed-off-by: Ben Ridley <benridley29@gmail.com>
This commit is contained in:
retryW
2020-12-21 17:11:11 +11:00
committed by Ben Ridley
parent 71054ac429
commit f76334213d

View File

@@ -171,15 +171,15 @@ func (c *OSCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, er
float64(dst[0].FreePhysicalMemory*1024), // KiB -> bytes
)
time := dst[0].LocalDateTime
currentTime := time.Now()
ch <- prometheus.MustNewConstMetric(
c.Time,
prometheus.GaugeValue,
float64(time.Unix()),
float64(currentTime.Unix()),
)
timezoneName, _ := time.Zone()
timezoneName, _ := currentTime.Zone()
ch <- prometheus.MustNewConstMetric(
c.Timezone,