1. 7
  1.  

  2. 2

    Another leap second, another slew of blog posts about them.

    1. 4

      guess the posts will continue until folks get in the habit of using monotonic clocks for durations, and standard libraries support them more easily :)

    2. 2

      …and subtract it from the first value you got.

      The direction of the subtraction there is backwards from what I suspect was intended.

      Perhaps more importantly, in the second code block (just after that):

      a := monotime.Now()
      someExpensiveOperation()
      b := monotime.Now()
      // b - a will *always* be greater than 0
      

      That depends on your clock’s resolution – it might very well be zero if it’s coarse enough relative to the timed operation. “Never less than zero” would be a safer guarantee.