From f3593225f851ed1dc051abfffc2171357dff3cf0 Mon Sep 17 00:00:00 2001 From: whyrusleeping Date: Mon, 14 Oct 2019 13:39:42 +0900 Subject: [PATCH] add timestamp to chain list command output --- cli/chain.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cli/chain.go b/cli/chain.go index 3782d42d5..7e8896492 100644 --- a/cli/chain.go +++ b/cli/chain.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "fmt" + "time" cid "github.com/ipfs/go-cid" "golang.org/x/xerrors" @@ -321,7 +322,9 @@ var chainListCmd = &cli.Command{ } for i := len(tss) - 1; i >= 0; i-- { - fmt.Printf("%d [ ", tss[i].Height()) + mints := tss[i].MinTimestamp() + t := time.Unix(int64(mints), 0) + fmt.Printf("%d: (%s) [ ", tss[i].Height(), t.Format(time.Stamp)) for _, b := range tss[i].Blocks() { fmt.Printf("%s: %s,", b.Cid(), b.Miner) }