top | item 30749759

(no title)

ts4z | 4 years ago

time.Second*1 gets the same value; it's not overloaded. Well, ok, so what actually happens is that time.Second is a time.Duration, and Duration*int yields Duration (and int*Duration yields Duration).

But the value of time.Second is actually a Duration with value 1000000, IIRC -- it's microseconds. It's just the type that's special, and the int handling here is general over a lot of types.

It really is nice in practice.

discuss

order

ts4z|4 years ago

(As noted elsewhere it's nanoseconds.)