3 ms·
Has that changed? I couldn't before!
by dm319 6y ago
Has that changed? I couldn't before!
- TheDong 6y agoYou have been able to divide a time.Duration by an integer since before go 1.0. As you can see in the stdlib, time.Duration is just an int64 (https://golang.org/pkg/time/#Duration https://golang.org/pkg/time/#Duration). You do have to cast the integer to a time.Duration sometimes. Here's a playground showing cases where it works and cases where it require a cast: https://play.golang.org/p/6Pbqrz8ZZ3t https://play.golang.org/p/6Pbqrz8ZZ3t
- dm319 6y agoSo I'm not wrong then? You're needing to cast an Int into a time duration in order to divide a time duration?