title: Monotonic clock on OSX
body: <p>CLOCK_MONOTONIC does not seem available, so clock_gettime is out.</p>
  
  <p>I've read in some places that mach_absolute_time() might be the right way to go, but after reading that it was a 'cpu dependent value', it instantly made me wonder if it is using rtdsc underneath.  Thus, the value could drift over time even if it is monotonic.  Also, issues with thread affinity could result in meaningfully different results from calling the function (making it not monotonic across all cores).</p>
  
  <p>Of course, that is just speculation.  Does anyone know how mach_absolute_time actually works?  I'm actually looking for a replacement to clock_gettime(CLOCK_MONOTONIC... or something like it for OSX.  No matter what the clock source is, I expect at least millisecond precision and millisecond accuracy.</p>
  
  <p>I'd just like to understand what clocks are available, which clocks are monotonic, if certain clocks drift, have thread affinity issues, aren't supported on all Mac hardware, or take a 'super high' number of cpu cycles to execute. </p>
  
  <p>Here are the links I was able to find about this topic (some are already dead links and not findable on archive.org):</p>
  
  <p><a href="https://developer.apple.com/library/mac/#qa/qa1398/_index.html">https://developer.apple.com/library/mac/#qa/qa1398/_index.html</a>
  http://www.wand.net.nz/~smr26/wordpress/2009/01/19/monotonic-time-in-mac-os-x/
  <a href="http://www.meandmark.com/timing.pdf">http://www.meandmark.com/timing.pdf</a></p>
  
  <p>Thanks!
  Brett</p>