Calculates the time passed from the reference to this timeStamp.
The result is the relative time from the reference to this
timestamp, so that reference + result = this.

@param reference another time stamp
@return the duration from the reference to this
777209
public TimeDuration durationFrom(Timestamp reference) {
        long nanoSecDiff = nanoSec - reference.nanoSec;
        nanoSecDiff += (unixSec - reference.unixSec) * 1000000000;
        return TimeDuration.ofNanos(nanoSecDiff);
    }
1360168
public T getAndSetReference(final T newValue) {
        _lock.writeLock().lock();
        final T oldReference = _reference.getAndSet(newValue);
        _lock.writeLock().unlock();
        return oldReference;
    }
309203
private Double getDuration(Duration duration)
   {
      Double result;
      if (duration == null)
      {
         result = null;
      }
      else
      {
         if (duration.getUnits() != TimeUnit.HOURS)
         {
            duration = duration.convertUnits(TimeUnit.HOURS, m_projectFile.getProjectProperties());
         }

         result = Double.valueOf(duration.getDuration());
      }
      return result;
   }
511572
@Override
	public double getPaymentOffset(double fixingTime) {
		if(paymentOffsetCode == null) {
			return paymentOffset;
		}

		if(paymentOffsets.containsKey(fixingTime)) {
			return paymentOffsets.get(fixingTime);
		}
		else {
			/**
			 *  @TODO In case paymentDate is relevant for the index modeling, it should be checked
			 *  if the following derivation of paymentDate is accurate (e.g. wo we have a fixingOffset).
			 *  In such a case, this method may be overridden.
			 */
			LocalDate referenceDate = getReferenceDate();
			LocalDate fixingDate = FloatingpointDate.getDateFromFloatingPointDate(referenceDate, fixingTime);
			LocalDate paymentDate = paymentBusinessdayCalendar.getAdjustedDate(fixingDate, paymentOffsetCode, paymentDateRollConvention);
			double paymentTime = FloatingpointDate.getFloatingPointDateFromDate(referenceDate, paymentDate);
			paymentOffsets.put(fixingTime, paymentTime-fixingTime);
			return paymentTime-fixingTime;
		}
	}
603574
public static final BigDecimal printDurationInDecimalThousandthsOfMinutes(Duration duration)
   {
      BigDecimal result = null;
      if (duration != null && duration.getDuration() != 0)
      {
         result = BigDecimal.valueOf(printDurationFractionsOfMinutes(duration, 1000));
      }
      return result;
   }
580215
@Override
	public Time getTime(final int columnIndex, final Calendar cal) throws SQLException {
		return wrapped.getTime(columnIndex, cal);
	}
1355167
@Override
  public Date getFireTimeAfter (@Nullable final Date aAfterTime)
  {
    if (m_bComplete)
      return null;

    if ((m_nTimesTriggered > m_nRepeatCount) && (m_nRepeatCount != REPEAT_INDEFINITELY))
      return null;

    Date afterTime = aAfterTime;
    if (afterTime == null)
      afterTime = new Date ();

    if (m_nRepeatCount == 0 && afterTime.compareTo (getStartTime ()) >= 0)
      return null;

    final long startMillis = getStartTime ().getTime ();
    final long afterMillis = afterTime.getTime ();
    final long endMillis = (getEndTime () == null) ? Long.MAX_VALUE : getEndTime ().getTime ();

    if (endMillis <= afterMillis)
      return null;

    if (afterMillis < startMillis)
      return new Date (startMillis);

    final long numberOfTimesExecuted = ((afterMillis - startMillis) / m_nRepeatInterval) + 1;

    if ((numberOfTimesExecuted > m_nRepeatCount) && (m_nRepeatCount != REPEAT_INDEFINITELY))
      return null;

    final Date time = new Date (startMillis + (numberOfTimesExecuted * m_nRepeatInterval));
    if (endMillis <= time.getTime ())
      return null;
    return time;
  }
1104121
@Override public int compareTo(Annotation that) {
    if (this == that) return 0;
    int byTimestamp = timestamp() < that.timestamp() ? -1 : timestamp() == that.timestamp() ? 0 : 1;
    if (byTimestamp != 0) return byTimestamp;
    return value().compareTo(that.value());
  }
1086544
synchronized long calculateNextExpiration()
    {
        boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
        if (isTraceOn && tc.isEntryEnabled())
            Tr.entry(tc, "calculateNextExpiration: " + this);

        ivLastExpiration = ivExpiration; // 598265

        if (ivParsedScheduleExpression != null) {
            // F7437591.codRev - getNextTimeout returns -1 for "no more timeouts",
            // but this class uses ivExpiration=0.
            ivExpiration = Math.max(0, ivParsedScheduleExpression.getNextTimeout(ivExpiration));
        }
        else {
            if (ivInterval > 0) {
                ivExpiration += ivInterval; // 597753
            }
            else {
                ivExpiration = 0;
            }
        }

        if (isTraceOn && tc.isEntryEnabled())
            Tr.exit(tc, "calculateNextExpiration: " + ivExpiration); // 597753

        return ivExpiration;
    }
1011361
public double getDuration() {
    Map<String, Object> meta = getFileMetaData();
    if (meta != null && meta.containsKey(DURATION)) {
      return ((Number) meta.get(DURATION)).doubleValue();
    }
    return 0;
  }
327113
public long tick() {
        long tick = System.currentTimeMillis();
        long diff = tick - _lastTick;
        _lastTick = tick;

        return diff;
    }
1187816
@Override
    public Reference getReference() {

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
            SibTr.entry(this, TRACE, "getReference");

        final Reference reference = _managedConnectionFactory.getReference();

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
            SibTr.exit(this, TRACE, "getReference", reference);

        return reference;
    }
827727
@Override
    protected long overallEndTime() {
        long ret = super.overallEndTime();

        for (Node child : nodes) {
            long childEndTime = child.overallEndTime();

            if (childEndTime > ret) {
                ret = childEndTime;
            }
        }

        return ret;
    }
7702
public double getElapsedTimeCurrentThread(int from, int to) {
	   Accumulator acc = getAccForThread();

	   return acc == null ? Double.NaN : (acc.currentTimes[to] - acc.currentTimes[from]) / MILLION;
   }
284145
public long getLastAccessedTime() {
        if (!_iSess.isValid())
            throw new IllegalStateException();
        long value = 0;
        if (_iSess != null) {
            value = _iSess.getLastAccessedTime();
        }
        return value;
    }
841090
public long getTimestamp() {
		Long res = getEntity(invokeGet("utils/timestamp", null), Long.class);
		return res != null ? res : 0L;
	}
334363
public String format(Date ref, Date then)
    {
        return prettyTime.format(DurationHelper.calculateDuration(ref, then, prettyTime.getUnits()));
    }