Conversion of time.Duration type microseconds value to milliseconds

后端 未结 3 2091
你的背包
你的背包 2020-12-01 07:41

I am using go-ping ( https://github.com/sparrc/go-ping )library of golang for unprivileged ICMP ping.

timeout := time.Second*1000
interval := time.Second
cou         


        
3条回答
  •  余生分开走
    2020-12-01 08:04

    As of Go 1.13, you can use new Duration methods Microseconds and Milliseconds which return the duration as an integer count of their respectively named units.

    https://golang.org/doc/go1.13#time

提交回复
热议问题