code: protected long getDelta (long timeStamp, long maxValue)
      {
          boolean even = (evenBase > oddBase);
          long base = even ? evenBase : oddBase;
          long delta = timeStamp - base;
  
          // make sure this timestamp is not sufficiently old that we can't
          // generate a delta time with it
          if (delta < 0) {
              String errmsg = "Time stamp too old for conversion to delta time";
              throw new IllegalArgumentException(errmsg);
          }
  
          // see if it's time to swap
          if (delta > maxValue) {
              if (even) {
                  setOddBase(timeStamp);
              } else {
                  setEvenBase(timeStamp);
              }
              delta = 0;
          }
  
          // if we're odd, we need to mark the value as such
          if (!even) {
              delta = (-1 - delta);
          }
  
          return delta;
      }
docs: Obtains a delta with the specified maximum value, swapping from
  even to odd, if necessary.