summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--gobgp/cmd/neighbor.go3
-rw-r--r--table/path.go2
2 files changed, 3 insertions, 2 deletions
diff --git a/gobgp/cmd/neighbor.go b/gobgp/cmd/neighbor.go
index c8ac5696..9fbffdc2 100644
--- a/gobgp/cmd/neighbor.go
+++ b/gobgp/cmd/neighbor.go
@@ -288,6 +288,7 @@ func ShowRoute(pathList []*Path, showAge, showBest, showLabel, isMonitor, printH
maxAsPathLen := 20
maxLabelLen := 10
+ now := time.Now()
for _, p := range pathList {
var nexthop string
var aspathstr string
@@ -373,7 +374,7 @@ func ShowRoute(pathList []*Path, showAge, showBest, showLabel, isMonitor, printH
}
args = append(args, []interface{}{nexthop, aspathstr}...)
if showAge {
- args = append(args, formatTimedelta(p.Age))
+ args = append(args, formatTimedelta(int64(now.Sub(time.Unix(int64(p.Age), 0)).Seconds())))
}
args = append(args, pattrstr)
pathStrs = append(pathStrs, args)
diff --git a/table/path.go b/table/path.go
index 622ba6d2..1a10b965 100644
--- a/table/path.go
+++ b/table/path.go
@@ -266,7 +266,7 @@ func (path *Path) ToApiStruct(id string) *api.Path {
return &api.Path{
Nlri: n,
Pattrs: pattrs,
- Age: int64(time.Now().Sub(path.OriginInfo().timestamp).Seconds()),
+ Age: path.OriginInfo().timestamp.Unix(),
IsWithdraw: path.IsWithdraw,
Validation: int32(path.OriginInfo().validation.ToInt()),
Filtered: path.Filtered(id) == POLICY_DIRECTION_IN,