4 ms·
And durations: package main import "fmt" import "time" func main() { three_secs, _ := time.ParseDuration("3s") five :=
by xigoi 4y ago
And durations:
package main
import "fmt"
import "time"
func main() {
three_secs, _ := time.ParseDuration("3s")
five := 5
fmt.Println(five * three_secs) // error: type mismatch
fmt.Println(three_secs * three_secs) // 2500000h0m0s
}
- scubbo 4y agoGood Lord. EDIT: Wait, I don't even understand how that can work, even in a broken way. Since I guessed 25000006060=9,000,000,000, I guessed that a "second duration" is really just a wrapper around `3,000` (ms) or `3,000,000` (ns) - but neither of those square to 9E9. In fact, the square root of 9E9 is a distinctly non-round number. What's going on here?