code: public long getTimestamps(int range) throws TException {
  
      // can get 2^18(262144) times for each millisecond for about 1115 years
      long currentTime = System.currentTimeMillis() << 18;
      synchronized (this) {
        // maxAssignedTimestamp is assigned last time, can't return currentTime when it's less or equal
        if (currentTime > maxAssignedTimestamp) {
          maxAssignedTimestamp = currentTime + range - 1;
        } else {
          maxAssignedTimestamp += range;
        }
        // now [maxAssignedTimestamp - range + 1, maxAssignedTimestamp] will be returned
  
        // for correctness, compare with persistent timestamp and set it if necessary
        if (maxAssignedTimestamp >= chronosServerWatcher.getCachedPersistentTimestamp()) {
  
          // wait for the result of asyn set
          sleepUntilAsyncSet();
  
          // sync set persistent timestamp if necessary
          if (maxAssignedTimestamp >= chronosServerWatcher.getCachedPersistentTimestamp()) {
            long newPersistentTimestamp = maxAssignedTimestamp + zkAdvanceTimestamp;
            if (LOG.isDebugEnabled()) {
              LOG.debug("Try to sync set persistent timestamp " + newPersistentTimestamp);
            }
            try {
              chronosServerWatcher.setPersistentTimestamp(newPersistentTimestamp);
            } catch (ChronosException e) {
              LOG.fatal("Error to set persistent timestamp, exit immediately");
              System.exit(0);
            }
          }
  
        }
  
        // for performance, async set persistent timestamp before reaching persistent timestamp
        if (!isAsyncSetPersistentTimestamp
            && maxAssignedTimestamp >= chronosServerWatcher.getCachedPersistentTimestamp()
                - zkAdvanceTimestamp * 0.5) {
          long newPersistentTimestamp = chronosServerWatcher.getCachedPersistentTimestamp()
              + zkAdvanceTimestamp;
          if (LOG.isDebugEnabled()) {
            LOG.debug("Try to async set persistent timestamp " + newPersistentTimestamp);
          }
          isAsyncSetPersistentTimestamp = true;
          asyncSetPersistentTimestamp(newPersistentTimestamp);
        }
  
        // return the first available timestamp
        return maxAssignedTimestamp - range + 1;
      }
    }
docs: Assign required number of timestamps, client can use [timestamp, timestamp + range).
  
  @param range, the number of timestamps to assign
  @return timestamp, the first available timestamp to client