public long getAdjustedDuration(final long begin, final long end) {
    long duration = end - begin;
    synchronized (myPeriods) {
      for (TimeRange freeze : myPeriods) {
        final long freezeStart = freeze.begin;
        if (freezeStart > begin  && freezeStart < end) {
          duration -= (Math.min(end, freeze.end) - freezeStart);
        }
      }
    }
    return duration;
  }
public long getAdjustedDuration(final long begin, final long end)