Converts the Calendar to a corresponding {@link java.time.LocalTime}. If the Calendar has a different
time zone than the system default, the LocalTime will be adjusted into the default time zone.

@param self a Calendar
@return a LocalTime
@since 2.5.0
964865
public static LocalTime toLocalTime(final Calendar self) {
        int hour = self.get(Calendar.HOUR_OF_DAY);
        int minute = self.get(Calendar.MINUTE);
        int second = self.get(Calendar.SECOND);
        int ns = self.get(Calendar.MILLISECOND) * 1_000_000;
        return LocalTime.of(hour, minute, second, ns);
    }
1372923
@Nullable
  public static LocalTime getLocalTime (@Nullable final XMLGregorianCalendar aCal)
  {
    if (aCal == null)
      return null;
    return getGregorianCalendar (aCal).toZonedDateTime ().toLocalTime ();
  }
1337530
public long getLocalTime()
  {
    // If this is a local time zone date, just set the time
    if (_timeZone != _gmtTimeZone) {
      return _localTimeOfEpoch;
    }
    // If this is a GMT date, convert from local to GMT
    else {
      long offset = _localTimeZone.getOffset(GregorianCalendar.AD,
                                             (int) _year,
                                             (int) _month,
                                             (int) _dayOfMonth + 1,
                                             getDayOfWeek(),
                                             (int) _timeOfDay);

      return _localTimeOfEpoch + offset;
    }
  }
257245
public LocalDate getStartAsLocalDate() {

        PlainDate date = this.getStartAsCalendarDate();
        return ((date == null) ? null : date.toTemporalAccessor());

    }
379790
@SuppressWarnings("deprecation")
    public static LocalTime toLocalTime(java.sql.Time sqlTime) {
        return LocalTime.of(sqlTime.getHours(), sqlTime.getMinutes(), sqlTime.getSeconds());
    }
321071
private TimeZone getTimeZone() {

        // If no time zone is set, use the default
        String timeZone = getModel().getTimeZone();
        if (timeZone == null)
            return TimeZone.getDefault();

        // Otherwise parse and return time zone
        return TimeZone.getTimeZone(timeZone);

    }
840453
public TimeZone getTimeZone()
    {
        // If the TimeZone object is shared by other Calendar instances, then
        // create a clone.
        if (sharedZone) {
            zone = (TimeZone) zone.clone();
            sharedZone = false;
        }
        return zone;
    }
766792
public static Calendar calendar(long millis) {
		final Calendar cal = Calendar.getInstance();
		cal.setTimeInMillis(millis);
		return cal;
	}
1356253
public LocalDateTime getStartAsLocalDateTime() {

        PlainTimestamp tsp = this.getStartAsTimestamp();
        return ((tsp == null) ? null : tsp.toTemporalAccessor());

    }
1267487
private static Calendar getInstanceInternal(TimeZone tz, ULocale locale) {
        if (locale == null) {
            locale = ULocale.getDefault(Category.FORMAT);
        }
        if (tz == null) {
            tz = TimeZone.getDefault();
        }

        Calendar cal = createInstance(locale);
        cal.setTimeZone(tz);
        cal.setTimeInMillis(System.currentTimeMillis());
        return cal;
    }
44011
public Calendar toCalendar(T dateTime, Locale locale) {
    return toDateTime(dateTime).toCalendar(locale);
  }
349866
public static Month toMonth(final Calendar self) {
        return Month.of(self.get(Calendar.MONTH) + 1);
    }
614175
public static Calendar previous(Calendar self) {
        Calendar result = (Calendar) self.clone();
        result.add(Calendar.DATE, -1);
        return result;
    }
798142
public static LocalDateTime of(LocalDate date, LocalTime time) {
        Objects.requireNonNull(date, "date");
        Objects.requireNonNull(time, "time");
        return new LocalDateTime(date, time);
    }
1309083
private Timestamp make_localtime()
    {
        int offset = _offset != null
            ? _offset.intValue()
            : 0;

        // We use a Copy-Constructor that expects the time parameters to be in
        // UTC, as that's what we're supposed to have.
        // As this Copy-Constructor doesn't apply local offset to the time
        // field values (it assumes that the local offset is already applied to
        // them), we explicitly apply the local offset to the time field values
        // after we obtain the new Timestamp instance.
        Timestamp localtime = new Timestamp(_precision,
                                            _year,
                                            _month,
                                            _day,
                                            _hour,
                                            _minute,
                                            _second,
                                            _fraction,
                                            _offset,
                                            APPLY_OFFSET_NO);
        // explicitly apply the local offset to the time field values
        localtime.apply_offset(-offset);

        assert localtime._offset == _offset;

        return localtime;
    }
1101554
public static final <T extends Calendar> Function<T, LocalDate> calendarToLocalDate(DateTimeZone dateTimeZone) {
		return FnLocalDate.calendarToLocalDate(dateTimeZone);
	}
1191539
private Calendar createCalendar(long time)
    {
        // The specification accounts for gregorian dates only.
        Calendar cal = new GregorianCalendar(timeZone); // d639610
        cal.setTimeInMillis(time);

        return cal;
    }