Skip to content

Commit 6e04b47

Browse files
committed
Fix the block meta timestamp (#1039)
1 parent 9164db2 commit 6e04b47

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

cli/ioctl/cmd/bc/bcblock.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"fmt"
1212
"strconv"
1313

14+
"github.com/golang/protobuf/ptypes"
1415
"github.com/spf13/cobra"
1516
"google.golang.org/grpc/status"
1617

@@ -64,10 +65,14 @@ func getBlock(args []string) (string, error) {
6465
if err != nil {
6566
return "", err
6667
}
68+
ts, err := ptypes.Timestamp(blockMeta.Timestamp)
69+
if err != nil {
70+
return "", err
71+
}
6772
return fmt.Sprintf("Transactions: %d\n", blockMeta.NumActions) +
6873
fmt.Sprintf("Height: %d\n", blockMeta.Height) +
6974
fmt.Sprintf("Total Amount: %s\n", blockMeta.TransferAmount) +
70-
fmt.Sprintf("Timestamp: %d\n", blockMeta.Timestamp) +
75+
fmt.Sprintf("Timestamp: %d\n", ts.Unix()) +
7176
fmt.Sprintf("Producer Address: %s %s\n", blockMeta.ProducerAddress,
7277
action.Match(blockMeta.ProducerAddress, "address")) +
7378
fmt.Sprintf("Transactions Root: %s\n", blockMeta.TxRoot) +

0 commit comments

Comments
 (0)