title: clock_gettime can't get the exact CPU time of thread on Mac with m1 chip
body: <p>I used clock_gettime(CLOCK_THREAD_CPUTIME_ID, &amp;ts) to get the CPU time of the thread but found that the time fetched through it on M1 was very small. The iPhone and non-M1 devices are fine.</p>
  <p>Here is the code:</p>
  <pre class="lang-objectivec prettyprint-override"><code>double CPUTime()
  {
      struct timespec ts;
      int ret = clock_gettime(CLOCK_THREAD_CPUTIME_ID, &amp;ts);
      return ts.tv_sec + ts.tv_nsec/1000.0/1000.0/1000.0;
  }
  
  double RealTime()
  {
      struct timespec ts;
      int ret = clock_gettime(CLOCK_MONOTONIC, &amp;ts);
      return ts.tv_sec + ts.tv_nsec/1000.0/1000.0/1000.0;
  }
  
  void longTask()
  {
      double begin = RealTime();
      double limit = 1.0;
      static double g_result = 0;
      while (1) {
          for (int i=0; i&lt;1000000; i++) {
              g_result = sin(g_result+5);
          }
          double now = RealTime();
          if (now - begin &gt;= limit) break;
      }
      return;
  }
  
  void testClocks()
  {
      double t1, t0, cpuTimeCost, realTimeCost;
      
      t0 = CPUTime();
      longTask();
      t1 = CPUTime();
      cpuTimeCost = t1 - t0;
      
      double t10 = RealTime();
      longTask();
      double t11 = RealTime();
      realTimeCost = t11 - t10;
      NSLog(@&quot;\nthread cpu: %lfs\nreal: %lfs&quot;, cpuTimeCost, realTimeCost);
      return;
  }
  </code></pre>
  <p>the output is:</p>
  <pre><code>thread cpu: 0.024395s
  real: 1.006627s
  </code></pre>
  <p>By contrast, on iPhone or Mac with an Intel chip, these two values are almost the same.
  Any help here? I've tried the Rosetta and it has the same problem.</p>