diff --git a/api/nodes.go b/api/nodes.go index 76e25594f..de73e12c4 100644 --- a/api/nodes.go +++ b/api/nodes.go @@ -212,7 +212,7 @@ type NodeEvent struct { Message string Subsystem string Details map[string]string - Timestamp int64 + Timestamp time.Time CreateIndex uint64 } diff --git a/client/client.go b/client/client.go index f1022f444..432c5b815 100644 --- a/client/client.go +++ b/client/client.go @@ -1069,7 +1069,7 @@ func (c *Client) updateNodeFromDriver(name string, fingerprint, health *structs. event := &structs.NodeEvent{ Subsystem: "Driver", Message: health.HealthDescription, - Timestamp: time.Now().Unix(), + Timestamp: time.Now(), } c.triggerNodeEvent(event) } diff --git a/command/node_status.go b/command/node_status.go index e3bb9baeb..c914950a2 100644 --- a/command/node_status.go +++ b/command/node_status.go @@ -429,7 +429,7 @@ func (c *NodeStatusCommand) outputNodeEvent(events []*api.NodeEvent) { } for i, event := range events { - timestamp := formatTime(time.Unix(event.Timestamp, 0)) + timestamp := formatTime(event.Timestamp) subsystem := event.Subsystem msg := event.Message if c.verbose { diff --git a/nomad/state/state_store.go b/nomad/state/state_store.go index 6e4f3978d..e5ce02838 100644 --- a/nomad/state/state_store.go +++ b/nomad/state/state_store.go @@ -6,6 +6,7 @@ import ( "io" "log" "sort" + "time" "github.com/hashicorp/go-memdb" multierror "github.com/hashicorp/go-multierror" @@ -538,7 +539,7 @@ func (s *StateStore) UpsertNode(index uint64, node *structs.Node) error { nodeEvent := &structs.NodeEvent{ Message: "Node Registered", Subsystem: "Cluster", - Timestamp: node.StatusUpdatedAt, + Timestamp: time.Unix(node.StatusUpdatedAt, 0), } node.Events = []*structs.NodeEvent{nodeEvent} node.CreateIndex = index diff --git a/nomad/structs/structs.go b/nomad/structs/structs.go index ed18588f5..570fccb2c 100644 --- a/nomad/structs/structs.go +++ b/nomad/structs/structs.go @@ -1188,7 +1188,7 @@ type NodeEvent struct { Message string Subsystem string Details map[string]string - Timestamp int64 + Timestamp time.Time CreateIndex uint64 }