コード例 #1
0
 private long truncateMillisPeriod(final long t) {
   // toStandardDuration assumes days are always 24h, and hours are always 60 minutes,
   // which may not always be the case, e.g if there are daylight saving changes.
   if (chronology.days().isPrecise() && chronology.hours().isPrecise()) {
     final long millis = period.toStandardDuration().getMillis();
     long offset = t % millis - origin % millis;
     if (offset < 0) {
       offset += millis;
     }
     return t - offset;
   } else {
     throw new UnsupportedOperationException(
         "Period cannot be converted to milliseconds as some fields mays vary in length with chronology "
             + chronology.toString());
   }
 }