code: private void waitForNextRecord(long startingTime, long timestamp) {
          if(mFirstTimestamp == 0) {
              mFirstTimestamp = timestamp;
              Log.d(TAG, "Storing " + timestamp + " as the first " +
                      "timestamp of the trace file");
          }
          long targetTime = startingTime + (timestamp - mFirstTimestamp);
          long sleepDuration = Math.max(targetTime - System.currentTimeMillis(), 0);
          try {
              Thread.sleep(sleepDuration);
          } catch(InterruptedException e) {}
      }
docs: Using the startingTime as the relative starting point, sleep this thread
  until the next timestamp would occur.
  
  @param startingTime the relative starting time in milliseconds
  @param timestamp the timestamp to wait for in milliseconds since the
  epoch