org.joda.time.field.PreciseDurationField Java Examples

The following examples show how to use org.joda.time.field.PreciseDurationField. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FixedYearLengthChronology.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * @param daysInYear The number of days in each year
 */
protected FixedYearLengthChronology(int daysInYear) {
  this.daysInYear = daysInYear;

  this.yearDuration = new PreciseDurationField(DurationFieldType.years(), daysInYear * dayDuration.getUnitMillis());
  this.centuryDuration = new PreciseDurationField(DurationFieldType.centuries(), 100 * yearDuration.getUnitMillis());

  this.dayOfYear = new OneBasedPreciseDateTimeField(DateTimeFieldType.dayOfYear(), dayDuration, this.yearDuration);
  this.yearOfCentury =
      new PreciseDateTimeField(DateTimeFieldType.yearOfCentury(), this.yearDuration, this.centuryDuration);
  this.year = new YearField(this.yearDuration);
}