title: Why does dividing two time.durations in Go result in another time.duration?
body: <p>I don't understand what it means to divide a <code>time.Duration</code> in Go. </p>
  
  <p>For example, this is super lovely:</p>
  
  <pre><code>d,_ := time.ParseDuration("4s")
  fmt.Println(d/4)
  </code></pre>
  
  <p>print <code>1s</code>. Which is ace, because (naively) 4 seconds divided by 4 is 1 second. </p>
  
  <p>It gets a little confusing though when we find out that the 4 in the denominator has to be a duration. So although:</p>
  
  <pre><code>d1 := time.Duration(4)
  fmt.Println(d/d1)
  </code></pre>
  
  <p>also prints <code>1s</code>, we know that <code>d1</code> is actually <code>4ns</code> and I'm entirely unconvinced that 4 seconds divided by 4 nanoseconds is 1 second.</p>
  
  <p>I'm confused because a duration divided by duration should be dimensionless (I think, right?), whereas a duration divided by a dimensionless number should have units of time. </p>
  
  <p>And I know that type != unit, but I'm clearly misunderstanding something, or quite possibly a set of things. Any help to clear this up would be most appreciated! </p>
  
  <p>Here is a go playground of the above examples. <a href="https://play.golang.org/p/Ny2_ENRlX6" rel="noreferrer">https://play.golang.org/p/Ny2_ENRlX6</a>. And just for context, I'm trying to calculate the average time between events. I can fall back to using floats for seconds, but am trying to stay in <code>time.Duration</code> land. </p>