[GO][EDIT] detect-internet collector now uses a specific timezone
This commit is contained in:
@@ -59,12 +59,14 @@ func (c *internetCollector) collect(ctx *collectorContext) error {
|
|||||||
// This function parses the status and the last change time of a specific interface
|
// This function parses the status and the last change time of a specific interface
|
||||||
func (c *internetCollector) collectStatusForEth(name string, se *proto.Sentence, ctx *collectorContext) {
|
func (c *internetCollector) collectStatusForEth(name string, se *proto.Sentence, ctx *collectorContext) {
|
||||||
layout := "Jan/02/2006 15:04:05"
|
layout := "Jan/02/2006 15:04:05"
|
||||||
|
// Set specific Timezone
|
||||||
|
loc, _ := time.LoadLocation("Europe/Paris")
|
||||||
// Parse date
|
// Parse date
|
||||||
v, ok := se.Map["state-change-time"]
|
v, ok := se.Map["state-change-time"]
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
t, err := time.Parse(layout, v)
|
t, err := time.ParseInLocation(layout, v, loc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.WithFields(log.Fields{
|
log.WithFields(log.Fields{
|
||||||
"device": ctx.device.Name,
|
"device": ctx.device.Name,
|
||||||
|
|||||||
Reference in New Issue
Block a user