Home | History | Annotate | Download | only in time

Lines Matching refs:hour

101  * often viewed as hour-minute-second.
141 * Constants for the local time of each hour.
159 * Minutes per hour.
171 * Seconds per hour.
195 * Nanos per hour.
209 * The hour.
211 private final byte hour;
279 * Obtains an instance of {@code LocalTime} from an hour and minute.
281 * This returns a {@code LocalTime} with the specified hour and minute.
284 * @param hour the hour-of-day to represent, from 0 to 23
285 * @param minute the minute-of-hour to represent, from 0 to 59
289 public static LocalTime of(int hour, int minute) {
290 HOUR_OF_DAY.checkValidValue(hour);
292 return HOURS[hour]; // for performance
295 return new LocalTime(hour, minute, 0, 0);
299 * Obtains an instance of {@code LocalTime} from an hour, minute and second.
301 * This returns a {@code LocalTime} with the specified hour, minute and second.
304 * @param hour the hour-of-day to represent, from 0 to 23
305 * @param minute the minute-of-hour to represent, from 0 to 59
310 public static LocalTime of(int hour, int minute, int second) {
311 HOUR_OF_DAY.checkValidValue(hour);
313 return HOURS[hour]; // for performance
317 return new LocalTime(hour, minute, second, 0);
321 * Obtains an instance of {@code LocalTime} from an hour, minute, second and nanosecond.
323 * This returns a {@code LocalTime} with the specified hour, minute, second and nanosecond.
325 * @param hour the hour-of-day to represent, from 0 to 23
326 * @param minute the minute-of-hour to represent, from 0 to 59
332 public static LocalTime of(int hour, int minute, int second, int nanoOfSecond) {
333 HOUR_OF_DAY.checkValidValue(hour);
337 return create(hour, minute, second, nanoOfSecond);
440 * Creates a local time from the hour, minute, second and nanosecond fields.
444 * @param hour the hour-of-day to represent, validated from 0 to 23
445 * @param minute the minute-of-hour to represent, validated from 0 to 59
450 private static LocalTime create(int hour, int minute, int second, int nanoOfSecond) {
452 return HOURS[hour];
454 return new LocalTime(hour, minute, second, nanoOfSecond);
460 * @param hour the hour-of-day to represent, validated from 0 to 23
461 * @param minute the minute-of-hour to represent, validated from 0 to 59
465 private LocalTime(int hour, int minute, int second, int nanoOfSecond) {
466 this.hour = (byte) hour;
666 case MINUTE_OF_DAY: return hour * 60 + minute;
667 case HOUR_OF_AMPM: return hour % 12;
668 case CLOCK_HOUR_OF_AMPM: int ham = hour % 12; return (ham % 12 == 0 ? 12 : ham);
669 case HOUR_OF_DAY: return hour;
670 case CLOCK_HOUR_OF_DAY: return (hour == 0 ? 24 : hour);
671 case AMPM_OF_DAY: return hour / 12;
678 * Gets the hour-of-day field.
680 * @return the hour-of-day, from 0 to 23
683 return hour;
687 * Gets the minute-of-hour field.
689 * @return the minute-of-hour, from 0 to 59
721 * A simple adjuster might simply set the one of the fields, such as the hour field.
722 * A more complex adjuster might set the time to the last hour of the day.
749 * This can be used to change any supported field, such as the hour, minute or second.
758 * The hour, minute and second will be unchanged.
765 * The hour, minute and second will be unchanged.
773 * The hour, minute and second will be unchanged.
780 * The hour, minute and nano-of-second will be unchanged.
785 * Returns a {@code LocalTime} with the specified minute-of-hour.
786 * The hour, second-of-minute and nano-of-second will be unchanged.
791 * Returns a {@code LocalTime} with the specified hour-of-am-pm.
792 * The AM/PM, minute-of-hour, second-of-minute and nano-of-second will be unchanged.
794 * Returns a {@code LocalTime} with the specified clock-hour-of-am-pm.
795 * The AM/PM, minute-of-hour, second-of-minute and nano-of-second will be unchanged.
797 * Returns a {@code LocalTime} with the specified hour-of-day.
798 * The minute-of-hour, second-of-minute and nano-of-second will be unchanged.
800 * Returns a {@code LocalTime} with the specified clock-hour-of-day.
801 * The minute-of-hour, second-of-minute and nano-of-second will be unchanged.
804 * The hour-of-am-pm, minute-of-hour, second-of-minute and nano-of-second will be unchanged.
841 case MINUTE_OF_DAY: return plusMinutes(newValue - (hour * 60 + minute));
842 case HOUR_OF_AMPM: return plusHours(newValue - (hour % 12));
843 case CLOCK_HOUR_OF_AMPM: return plusHours((newValue == 12 ? 0 : newValue) - (hour % 12));
846 case AMPM_OF_DAY: return plusHours((newValue - (hour / 12)) * 12);
855 * Returns a copy of this {@code LocalTime} with the hour-of-day altered.
859 * @param hour the hour-of-day to set in the result, from 0 to 23
860 * @return a {@code LocalTime} based on this time with the requested hour, not null
861 * @throws DateTimeException if the hour value is invalid
863 public LocalTime withHour(int hour) {
864 if (this.hour == hour) {
867 HOUR_OF_DAY.checkValidValue(hour);
868 return create(hour, minute, second, nano);
872 * Returns a copy of this {@code LocalTime} with the minute-of-hour altered.
876 * @param minute the minute-of-hour to set in the result, from 0 to 59
885 return create(hour, minute, second, nano);
902 return create(hour, minute, second, nano);
919 return create(hour, minute, second, nanoOfSecond);
1070 int newHour = ((int) (hoursToAdd % HOURS_PER_DAY) + hour + HOURS_PER_DAY) % HOURS_PER_DAY;
1089 int mofd = hour * MINUTES_PER_HOUR + minute;
1114 int sofd = hour * SECONDS_PER_HOUR +
1345 * be one hour as it is one minute short of two hours.
1445 int total = hour * SECONDS_PER_HOUR;
1458 long total = hour * NANOS_PER_HOUR;
1478 int cmp = Integer.compare(hour, other.hour);
1537 return hour == other.hour && minute == other.minute &&
1574 int hourValue = hour;
1608 * out.writeByte(~hour);
1610 * out.writeByte(hour);
1614 * out.writeByte(hour);
1619 * out.writeByte(hour);
1646 out.writeByte(~hour);
1648 out.writeByte(hour);
1652 out.writeByte(hour);
1657 out.writeByte(hour);
1665 int hour = in.readByte();
1669 if (hour < 0) {
1670 hour = ~hour;
1684 return LocalTime.of(hour, minute, second, nano);