org.joda.time.Instant.getChronology()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(9.8k)|赞(0)|评价(0)|浏览(155)

本文整理了Java中org.joda.time.Instant.getChronology()方法的一些代码示例,展示了Instant.getChronology()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Instant.getChronology()方法的具体详情如下:
包路径:org.joda.time.Instant
类名称:Instant
方法名:getChronology

Instant.getChronology介绍

[英]Gets the chronology of the instant, which is ISO in the UTC zone.

This method returns ISOChronology#getInstanceUTC() which corresponds to the definition of the Java epoch 1970-01-01T00:00:00Z.
[中]获取瞬间的时间顺序,它是UTC区域中的ISO。
此方法返回与Java epoch 1970-01-01T00:00:00Z的定义相对应的等时学#getInstanceUTC()。

代码示例

代码示例来源:origin: joda-time/joda-time

/**
 * Gets a copy of this instant with the specified duration added.
 * <p>
 * If the addition is zero, then <code>this</code> is returned.
 * 
 * @param durationToAdd  the duration to add to this one
 * @param scalar  the amount of times to add, such as -1 to subtract once
 * @return a copy of this instant with the duration added
 * @throws ArithmeticException if the new instant exceeds the capacity of a long
 */
public Instant withDurationAdded(long durationToAdd, int scalar) {
  if (durationToAdd == 0 || scalar == 0) {
    return this;
  }
  long instant = getChronology().add(getMillis(), durationToAdd, scalar);
  return withMillis(instant);
}

代码示例来源:origin: JodaOrg/joda-time

/**
 * Gets a copy of this instant with the specified duration added.
 * <p>
 * If the addition is zero, then <code>this</code> is returned.
 * 
 * @param durationToAdd  the duration to add to this one
 * @param scalar  the amount of times to add, such as -1 to subtract once
 * @return a copy of this instant with the duration added
 * @throws ArithmeticException if the new instant exceeds the capacity of a long
 */
public Instant withDurationAdded(long durationToAdd, int scalar) {
  if (durationToAdd == 0 || scalar == 0) {
    return this;
  }
  long instant = getChronology().add(getMillis(), durationToAdd, scalar);
  return withMillis(instant);
}

代码示例来源:origin: stanfordnlp/CoreNLP

public static Duration difference(Time t1, Time t2) {
 // TODO: Difference does not work between days of the week
 // Get duration from this t1 to t2
 if (t1 == null || t2 == null)
  return null;
 Instant i1 = t1.getJodaTimeInstant();
 Instant i2 = t2.getJodaTimeInstant();
 if (i1 == null || i2 == null)
  return null;
 Duration d = new DurationWithMillis(i2.getMillis() - i1.getMillis());
 Duration g1 = t1.getGranularity();
 Duration g2 = t2.getGranularity();
 Duration g = Duration.max(g1, g2);
 if (g != null) {
  Period p = g.getJodaTimePeriod();
  p = p.normalizedStandard();
  Period p2 = JodaTimeUtils.discardMoreSpecificFields(d.getJodaTimePeriod(), p.getFieldType(p.size() - 1), i1.getChronology());
  return new DurationWithFields(p2);
 } else {
  return d;
 }
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Gets a copy of this instant with the specified duration added.
 * <p>
 * If the addition is zero, then <code>this</code> is returned.
 * 
 * @param durationToAdd  the duration to add to this one
 * @param scalar  the amount of times to add, such as -1 to subtract once
 * @return a copy of this instant with the duration added
 * @throws ArithmeticException if the new instant exceeds the capacity of a long
 */
public Instant withDurationAdded(long durationToAdd, int scalar) {
  if (durationToAdd == 0 || scalar == 0) {
    return this;
  }
  long instant = getChronology().add(getMillis(), durationToAdd, scalar);
  return withMillis(instant);
}

代码示例来源:origin: org.joda/com.springsource.org.joda.time

/**
 * Gets a copy of this instant with the specified duration added.
 * <p>
 * If the addition is zero, then <code>this</code> is returned.
 * 
 * @param durationToAdd  the duration to add to this one
 * @param scalar  the amount of times to add, such as -1 to subtract once
 * @return a copy of this instant with the duration added
 * @throws ArithmeticException if the new instant exceeds the capacity of a long
 */
public Instant withDurationAdded(long durationToAdd, int scalar) {
  if (durationToAdd == 0 || scalar == 0) {
    return this;
  }
  long instant = getChronology().add(getMillis(), durationToAdd, scalar);
  return withMillis(instant);
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

/**
 * Gets a copy of this instant with the specified duration added.
 * <p>
 * If the addition is zero, then <code>this</code> is returned.
 * 
 * @param durationToAdd  the duration to add to this one
 * @param scalar  the amount of times to add, such as -1 to subtract once
 * @return a copy of this instant with the duration added
 * @throws ArithmeticException if the new instant exceeds the capacity of a long
 */
public Instant withDurationAdded(long durationToAdd, int scalar) {
  if (durationToAdd == 0 || scalar == 0) {
    return this;
  }
  long instant = getChronology().add(getMillis(), durationToAdd, scalar);
  return withMillis(instant);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.joda-time

/**
 * Gets a copy of this instant with the specified duration added.
 * <p>
 * If the addition is zero, then <code>this</code> is returned.
 * 
 * @param durationToAdd  the duration to add to this one
 * @param scalar  the amount of times to add, such as -1 to subtract once
 * @return a copy of this instant with the duration added
 * @throws ArithmeticException if the new instant exceeds the capacity of a long
 */
public Instant withDurationAdded(long durationToAdd, int scalar) {
  if (durationToAdd == 0 || scalar == 0) {
    return this;
  }
  long instant = getChronology().add(getMillis(), durationToAdd, scalar);
  return withMillis(instant);
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

/**
 * Gets a copy of this instant with the specified duration added.
 * <p>
 * If the addition is zero, then <code>this</code> is returned.
 * 
 * @param durationToAdd  the duration to add to this one
 * @param scalar  the amount of times to add, such as -1 to subtract once
 * @return a copy of this instant with the duration added
 * @throws ArithmeticException if the new instant exceeds the capacity of a long
 */
public Instant withDurationAdded(long durationToAdd, int scalar) {
  if (durationToAdd == 0 || scalar == 0) {
    return this;
  }
  long instant = getChronology().add(getMillis(), durationToAdd, scalar);
  return withMillis(instant);
}

代码示例来源:origin: Nextdoor/bender

/**
 * Gets a copy of this instant with the specified duration added.
 * <p>
 * If the addition is zero, then <code>this</code> is returned.
 * 
 * @param durationToAdd  the duration to add to this one
 * @param scalar  the amount of times to add, such as -1 to subtract once
 * @return a copy of this instant with the duration added
 * @throws ArithmeticException if the new instant exceeds the capacity of a long
 */
public Instant withDurationAdded(long durationToAdd, int scalar) {
  if (durationToAdd == 0 || scalar == 0) {
    return this;
  }
  long instant = getChronology().add(getMillis(), durationToAdd, scalar);
  return withMillis(instant);
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

/**
 * Gets a copy of this instant with the specified duration added.
 * <p>
 * If the addition is zero, then <code>this</code> is returned.
 * 
 * @param durationToAdd  the duration to add to this one
 * @param scalar  the amount of times to add, such as -1 to subtract once
 * @return a copy of this instant with the duration added
 * @throws ArithmeticException if the new instant exceeds the capacity of a long
 */
public Instant withDurationAdded(long durationToAdd, int scalar) {
  if (durationToAdd == 0 || scalar == 0) {
    return this;
  }
  long instant = getChronology().add(getMillis(), durationToAdd, scalar);
  return withMillis(instant);
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics

/**
 * Gets a copy of this instant with the specified duration added.
 * <p>
 * If the addition is zero, then <code>this</code> is returned.
 * 
 * @param durationToAdd  the duration to add to this one
 * @param scalar  the amount of times to add, such as -1 to subtract once
 * @return a copy of this instant with the duration added
 * @throws ArithmeticException if the new instant exceeds the capacity of a long
 */
public Instant withDurationAdded(long durationToAdd, int scalar) {
  if (durationToAdd == 0 || scalar == 0) {
    return this;
  }
  long instant = getChronology().add(getMillis(), durationToAdd, scalar);
  return withMillis(instant);
}

代码示例来源:origin: redfish64/TinyTravelTracker

/**
 * Gets a copy of this instant with the specified duration added.
 * <p>
 * If the addition is zero, then <code>this</code> is returned.
 * 
 * @param durationToAdd  the duration to add to this one
 * @param scalar  the amount of times to add, such as -1 to subtract once
 * @return a copy of this instant with the duration added
 * @throws ArithmeticException if the new instant exceeds the capacity of a long
 */
public Instant withDurationAdded(long durationToAdd, int scalar) {
  if (durationToAdd == 0 || scalar == 0) {
    return this;
  }
  long instant = getChronology().add(getMillis(), durationToAdd, scalar);
  return withMillis(instant);
}

代码示例来源:origin: edu.stanford.nlp/corenlp

public static Duration difference(Time t1, Time t2) {
 // Get duration from this t1 to t2
 if (t1 == null || t2 == null)
  return null;
 Instant i1 = t1.getJodaTimeInstant();
 Instant i2 = t2.getJodaTimeInstant();
 if (i1 == null || i2 == null)
  return null;
 Duration d = new DurationWithMillis(i2.getMillis() - i1.getMillis());
 Duration g1 = t1.getGranularity();
 Duration g2 = t2.getGranularity();
 Duration g = Duration.max(g1, g2);
 if (g != null) {
  Period p = g.getJodaTimePeriod();
  p = p.normalizedStandard();
  Period p2 = JodaTimeUtils.discardMoreSpecificFields(d.getJodaTimePeriod(), p.getFieldType(p.size() - 1), i1.getChronology());
  return new DurationWithFields(p2);
 } else {
  return d;
 }
}

代码示例来源:origin: edu.stanford.nlp/stanford-corenlp

public static Duration difference(Time t1, Time t2) {
 // TODO: Difference does not work between days of the week
 // Get duration from this t1 to t2
 if (t1 == null || t2 == null)
  return null;
 Instant i1 = t1.getJodaTimeInstant();
 Instant i2 = t2.getJodaTimeInstant();
 if (i1 == null || i2 == null)
  return null;
 Duration d = new DurationWithMillis(i2.getMillis() - i1.getMillis());
 Duration g1 = t1.getGranularity();
 Duration g2 = t2.getGranularity();
 Duration g = Duration.max(g1, g2);
 if (g != null) {
  Period p = g.getJodaTimePeriod();
  p = p.normalizedStandard();
  Period p2 = JodaTimeUtils.discardMoreSpecificFields(d.getJodaTimePeriod(), p.getFieldType(p.size() - 1), i1.getChronology());
  return new DurationWithFields(p2);
 } else {
  return d;
 }
}

代码示例来源:origin: com.guokr/stan-cn-com

public static Duration difference(Time t1, Time t2) {
 // TODO: Difference does not work between days of the week
 // Get duration from this t1 to t2
 if (t1 == null || t2 == null)
  return null;
 Instant i1 = t1.getJodaTimeInstant();
 Instant i2 = t2.getJodaTimeInstant();
 if (i1 == null || i2 == null)
  return null;
 Duration d = new DurationWithMillis(i2.getMillis() - i1.getMillis());
 Duration g1 = t1.getGranularity();
 Duration g2 = t2.getGranularity();
 Duration g = Duration.max(g1, g2);
 if (g != null) {
  Period p = g.getJodaTimePeriod();
  p = p.normalizedStandard();
  Period p2 = JodaTimeUtils.discardMoreSpecificFields(d.getJodaTimePeriod(), p.getFieldType(p.size() - 1), i1.getChronology());
  return new DurationWithFields(p2);
 } else {
  return d;
 }
}

相关文章