Skip to content

Commit 1d4c6f0

Browse files
mwfarbjuagargi
authored andcommitted
[pathdb_dump] Fix -t option timestamp (#46)
* [pathdb_dump] Fix -t option timestamp * Show positive expiration time
1 parent fb91209 commit 1d4c6f0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/pathdb_dump/pathdb_dump.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,14 @@ func newSegment(segType proto.PathSegType, srcI addr.ISD, srcA addr.AS, dstI add
7373
interfaces []asIface, updateTime, expiryTime int64) segment {
7474

7575
return segment{SegType: segType, Src: addr.IA{I: srcI, A: srcA}, Dst: addr.IA{I: dstI, A: dstA},
76-
interfaces: interfaces, Updated: time.Unix(0, updateTime), Expiry: time.Unix(0, expiryTime)}
76+
interfaces: interfaces, Updated: time.Unix(0, updateTime), Expiry: time.Unix(expiryTime, 0)}
7777
}
7878

7979
func (s segment) toString(showTimestamps bool) string {
8080
toRet := s.SegType.String() + "\t"
8181
now := time.Now()
8282
updatedStr := now.Sub(s.Updated).String()
83-
expiryStr := now.Sub(s.Expiry).String()
83+
expiryStr := s.Expiry.Sub(now).String()
8484
toRet += ifsArrayToString(s.interfaces)
8585
if showTimestamps {
8686
toRet += "\tUpdated: " + updatedStr + "\t: Expires in: " + expiryStr

0 commit comments

Comments
 (0)