/** @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);
  }
Пример #2
0
 /**
  * Get the day of year field for this chronology.
  *
  * @return DateTimeField or UnsupportedDateTimeField if unsupported
  */
 public DateTimeField dayOfYear() {
   return UnsupportedDateTimeField.getInstance(DateTimeFieldType.dayOfYear(), days());
 }