Returns a {@link Duration} calculated as: {@code this - timestamp}.

@param timestamp the {@code Timestamp} to subtract.
@return the calculated {@code Duration}. For invalid inputs, a {@code Duration} of zero is
returned.
@since 0.5
15852
public Duration subtractTimestamp(Timestamp timestamp) {
    long durationSeconds = getSeconds() - timestamp.getSeconds();
    int durationNanos = getNanos() - timestamp.getNanos();
    if (durationSeconds < 0 && durationNanos > 0) {
      durationSeconds += 1;
      durationNanos = (int) (durationNanos - NANOS_PER_SECOND);
    } else if (durationSeconds > 0 && durationNanos < 0) {
      durationSeconds -= 1;
      durationNanos = (int) (durationNanos + NANOS_PER_SECOND);
    }
    return Duration.create(durationSeconds, durationNanos);
  }
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;
   }
1143463
public static Duration of(String duration) {
    Matcher matcher = PATTERN.matcher(duration);
    Assert.isTrue(matcher.matches(), "Invalid duration: %s", duration);

    if (matcher.group(1) != null) {
      return INFINITE;
    } else {
      String unit = matcher.group(4);
      String value = matcher.group(3);
      return new Duration(Long.parseLong(value), SUFFIXES.get(unit));
    }
  }
638056
@Override
  public DurationFormatter getFormatter() {
    if (f == null) {
      if (fallback != null) {
        fallback = fallback.withLocale(localeName).withTimeZone(timeZone);
      }
      formatter = getPeriodFormatter();
      builder = getPeriodBuilder();

      f = createFormatter();
    }
    return f;
  }
33389
public static double durationMinutes(LocalDateTime start, LocalDateTime end)
   {
	   
      return Duration.between(start, end).toMinutes();
   }
116031
public Duration<ClockUnit> getDuration() {

        PlainTime t1 = this.getTemporalOfClosedStart();
        PlainTime t2 = this.getEnd().getTemporal();

        if (this.getEnd().isClosed()) {
            if (t2.getHour() == 24) {
                if (t1.equals(PlainTime.midnightAtStartOfDay())) {
                    return Duration.of(24, HOURS).plus(1, NANOS);
                } else {
                    t1 = t1.minus(1, NANOS);
                }
            } else {
                t2 = t2.plus(1, NANOS);
            }
        }

        return Duration.inClockUnits().between(t1, t2);

    }
661477
@Override
    public final <T extends TimePoint<? super U, T>> T subtractFrom(T time) {

        return this.add(time, this, true);

    }
1056076
public static OffsetDateTime getOffsetDateTime(long timestamp,
            ZoneOffset zoneOffset) {
        return Instant.ofEpochMilli(timestamp).atOffset(zoneOffset);
    }
990551
public final TemporalAmount getDuration() {
        if (duration == null) {
            return TemporalAmountAdapter.fromDateRange(getStart(), getEnd()).getDuration();
        }
        return duration.getDuration();
    }
841090
public long getTimestamp() {
		Long res = getEntity(invokeGet("utils/timestamp", null), Long.class);
		return res != null ? res : 0L;
	}
288803
public static Duration toDuration(String time) {
		if (isBlank(time)) {
			return Duration.ZERO;
		}
		return Duration.of(dehumanize(time), ChronoUnit.MILLIS);
	}
852052
public static Duration getDurationByTimeValues(final long hours, final long minutes, final long seconds) {
        return Duration.ofHours(hours).plusMinutes(minutes).plusSeconds(seconds);
    }
910
private Duration getDuration(TimeUnit units, Double duration)
   {
      Duration result = null;
      if (duration != null)
      {
         double durationValue = duration.doubleValue() * 100.0;

         switch (units)
         {
            case MINUTES:
            {
               durationValue *= MINUTES_PER_DAY;
               break;
            }

            case HOURS:
            {
               durationValue *= HOURS_PER_DAY;
               break;
            }

            case DAYS:
            {
               durationValue *= 3.0;
               break;
            }

            case WEEKS:
            {
               durationValue *= 0.6;
               break;
            }

            case MONTHS:
            {
               durationValue *= 0.15;
               break;
            }

            default:
            {
               throw new IllegalArgumentException("Unsupported time units " + units);
            }
         }

         durationValue = Math.round(durationValue) / 100.0;

         result = Duration.getInstance(durationValue, units);
      }

      return result;
   }
566070
@JsonProperty("duration")
    public Long getDuration() {
        if (start != null && end != null) {
            return start.until(end, ChronoUnit.MILLIS);
        } else {
            return null;
        }
    }
654847
public Timestamp plus(TimeDuration duration) {
        return createWithCarry(unixSec + duration.getSec(), nanoSec + duration.getNanoSec());
    }
371197
static Duration duration(String value) {
        Duration result;
        if (value != null) {
            value = value.trim();
            Matcher matcher = DURATION_PATTERN.matcher(value);
            if (matcher.matches()) {
                int hours = matcher.group(1) != null ? Integer.parseInt(matcher.group(1)) : 0;
                int minutes = matcher.group(2) != null ? Integer.parseInt(matcher.group(2)) : 0;
                int seconds = matcher.group(3) != null ? Integer.parseInt(matcher.group(3)) : 0;
                int millis = matcher.group(4) != null ? Integer.parseInt(matcher.group(4)) : 0;
                result = new Duration(hours, minutes, seconds, millis);
            } else {
                throw new IllegalArgumentException("Unknown format for value: " + value);
            }
        } else {
            result = null;
        }
        return result;
    }
901410
function (timestamp) {
        var time = (new Date(timestamp)).toISOString();
        return {
            msg       : time,
            msgLength : time.length
        };
    }