[#833] cli/netmap: Beautify output of MillisecondsPerBlock parameter

Convert milliseconds to `time.Duration` value and use its stringer in
`netinfo` command.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-10-14 11:27:08 +03:00 committed by Alex Vanin
parent 8f9b1fe090
commit e5e5395830

View file

@ -3,6 +3,7 @@ package cmd
import (
"context"
"encoding/hex"
"time"
"github.com/mr-tron/base58"
"github.com/nspcc-dev/neo-go/pkg/config/netmode"
@ -162,7 +163,7 @@ var netInfoCmd = &cobra.Command{
magic := netInfo.MagicNumber()
cmd.Printf("Network magic: [%s] %d\n", netmode.Magic(magic), magic)
cmd.Printf("MillisecondsPerBlock: %d\n", netInfo.MsPerBlock())
cmd.Printf("Time per block: %s\n", time.Duration(netInfo.MsPerBlock())*time.Millisecond)
netCfg := netInfo.NetworkConfig()