/* (non-Javadoc)
@see android.icu.util.TimeZone#observesDaylightTime()
490940
@Override
    public boolean observesDaylightTime() {
        long current = System.currentTimeMillis();

        if (finalZone != null) {
            if (finalZone.useDaylightTime()) {
                return true;
            } else if (current >= finalStartMillis) {
                return false;
            }
        }

        // Return TRUE if DST is observed at any future time
        long currentSec = Grego.floorDivide(current, Grego.MILLIS_PER_SECOND);
        int trsIdx = transitionCount - 1;
        if (dstOffsetAt(trsIdx) != 0) {
            return true;
        }
        while (trsIdx >= 0) {
            if (transitionTimes64[trsIdx] <= currentSec) {
                break;
            }
            if (dstOffsetAt(trsIdx - 1) != 0) {
                return true;
            }
            trsIdx--;
        }
        return false;
    }
1068764
public static String getDisplayedTimezone(long startMillis, String localTimezone,
                                              String eventTimezone) {
        String tzDisplay = null;
        if (!TextUtils.equals(localTimezone, eventTimezone)) {
            // Figure out if this is in DST
            TimeZone tz = TimeZone.getTimeZone(localTimezone);
            if (tz == null || tz.getID().equals("GMT")) {
                tzDisplay = localTimezone;
            } else {
                Time startTime = new Time(localTimezone);
                startTime.set(startMillis);
                tzDisplay = tz.getDisplayName(startTime.isDst != 0, TimeZone.SHORT);
            }
        }
        return tzDisplay;
    }
714291
public static void setMidnightUpdater(Handler h, Runnable r, String timezone) {
        if (h == null || r == null || timezone == null) {
            return;
        }
        long now = System.currentTimeMillis();
        Time time = new Time(timezone);
        time.set(now);
        long runInMillis = (24 * 3600 - time.hour * 3600 - time.minute * 60 -
                time.second + 1) * 1000;
        h.removeCallbacks(r);
        h.postDelayed(r, runInMillis);
    }
1166621
public int setDateTime(java.util.Date date, boolean bDisplayOption, int iMoveMode)
    {
        if (date == null)
            return this.setData(date, bDisplayOption, iMoveMode);
        m_calendar.setTime(date);
        m_calendar.set(Calendar.HOUR_OF_DAY, DBConstants.HOUR_DATE_ONLY);
        m_calendar.set(Calendar.MINUTE, 0);
        m_calendar.set(Calendar.SECOND, 0);
        m_calendar.set(Calendar.MILLISECOND, 0);
        date = m_calendar.getTime();
        return this.setValue(date.getTime(), bDisplayOption, iMoveMode);
    }
1354810
public void observeRestoreView(@Observes @After @RestoreView PhaseEvent event) {
        log.debug("After Restore View event");
        performObservation(event, PhaseIdType.RESTORE_VIEW);
    }
1122343
public void setTimeInMillis(long millis) {
        // If we don't need to recalculate the calendar field values,
        // do nothing.
// BEGIN Android-changed: Removed ZoneInfo support
//        if (time == millis && isTimeSet && areFieldsSet && areAllFieldsSet
//            && (zone instanceof ZoneInfo) && !((ZoneInfo)zone).isDirty()) {
        if (time == millis && isTimeSet && areFieldsSet && areAllFieldsSet) {
// END Android-changed: Removed ZoneInfo support

            return;
        }
        time = millis;
        isTimeSet = true;
        areFieldsSet = false;
        computeFields();
        areAllFieldsSet = areFieldsSet = true;
    }
111741
public void observe(int variable, int value) {
    getVariableMetaDataByReference(variable).put(CliqueTree.VARIABLE_OBSERVED_VALUE, Integer.toString(value));
  }
918607
public void show() {
        if (mListener == null) {
            throw new NullPointerException(
                    "Attempting to bind null listener to SlideDateTimePicker");
        }

        if (mInitialDate == null) {
            setInitialDate(new Date());
        }

        DateTimeDialogFragment dialogFragment =
                DateTimeDialogFragment.newInstance(
                        mListener,
                        mInitialDate,
                        mMinDate,
                        mMaxDate,
                        mIsClientSpecified24HourTime,
                        mIs24HourTime,
                        mTheme,
                        mIndicatorColor);

        dialogFragment.show(mFragmentManager,
                DateTimeDialogFragment.TAG_SLIDE_DATE_TIME_DIALOG_FRAGMENT);
    }
455236
public static java.util.TimeZone wrap(android.icu.util.TimeZone tz) {
        return new TimeZoneAdapter(tz);
    }
939696
public static int getDayAsReadableInt(long time) {
        Calendar cal = calendarThreadLocal.get();
        cal.setTimeInMillis(time);
        return getDayAsReadableInt(cal);
    }
1079853
synchronized void startBlinkTimer() {
        if(blinkTimer != null) {
            // Already on!
            return;
        }
        blinkTimer = new Timer("LanternaTerminalBlinkTimer", true);
        blinkTimer.schedule(new TimerTask() {
            @Override
            public void run() {
                blinkOn = !blinkOn;
                if(hasBlinkingText) {
                    repaint();
                }
            }
        }, deviceConfiguration.getBlinkLengthInMilliSeconds(), deviceConfiguration.getBlinkLengthInMilliSeconds());
    }
695750
public Timestamp getInternalTimestamp(ColumnInformation columnInfo, Calendar userCalendar,
      TimeZone timeZone) throws SQLException {
    if (lastValueWasNull()) {
      return null;
    }
    if (length == 0) {
      lastValueNull |= BIT_LAST_FIELD_NULL;
      return null;
    }

    int year = 1970;
    int month = 0;
    int day = 0;
    int hour = 0;
    int minutes = 0;
    int seconds = 0;
    int microseconds = 0;

    switch (columnInfo.getColumnType()) {
      case TIME:
        Calendar calendar = userCalendar != null ? userCalendar : Calendar.getInstance();

        boolean negate = false;
        if (length > 0) {
          negate = (buf[pos] & 0xff) == 0x01;
        }
        if (length > 4) {
          day = ((buf[pos + 1] & 0xff)
              + ((buf[pos + 2] & 0xff) << 8)
              + ((buf[pos + 3] & 0xff) << 16)
              + ((buf[pos + 4] & 0xff) << 24));
        }
        if (length > 7) {
          hour = buf[pos + 5];
          minutes = buf[pos + 6];
          seconds = buf[pos + 7];
        }

        if (length > 8) {
          microseconds = ((buf[pos + 8] & 0xff)
              + ((buf[pos + 9] & 0xff) << 8)
              + ((buf[pos + 10] & 0xff) << 16)
              + ((buf[pos + 11] & 0xff) << 24));
        }
        year = 1970;
        month = 1;
        day = ((negate ? -1 : 1) * day) + 1;
        hour = (negate ? -1 : 1) * hour;
        break;

      case STRING:
      case VARSTRING:
        String rawValue = new String(buf, pos, length, StandardCharsets.UTF_8);
        if (rawValue.startsWith("0000-00-00 00:00:00")) {
          lastValueNull |= BIT_LAST_ZERO_DATE;
          return null;
        }

        if (rawValue.length() >= 4) {
          year = Integer.parseInt(rawValue.substring(0, 4));
          if (rawValue.length() >= 7) {
            month = Integer.parseInt(rawValue.substring(5, 7));
            if (rawValue.length() >= 10) {
              day = Integer.parseInt(rawValue.substring(8, 10));
              if (rawValue.length() >= 19) {
                hour = Integer.parseInt(rawValue.substring(11, 13));
                minutes = Integer.parseInt(rawValue.substring(14, 16));
                seconds = Integer.parseInt(rawValue.substring(17, 19));
              }
              microseconds = extractNanos(rawValue) / 1000000;
            }
          }
        }
        break;

      default:
        year = ((buf[pos] & 0xff) | (buf[pos + 1] & 0xff) << 8);
        month = buf[pos + 2];
        day = buf[pos + 3];
        if (length > 4) {
          hour = buf[pos + 4];
          minutes = buf[pos + 5];
          seconds = buf[pos + 6];

          if (length > 7) {
            microseconds = ((buf[pos + 7] & 0xff)
                + ((buf[pos + 8] & 0xff) << 8)
                + ((buf[pos + 9] & 0xff) << 16)
                + ((buf[pos + 10] & 0xff) << 24));
          }
        }
    }

    Calendar calendar;
    if (userCalendar != null) {
      calendar = userCalendar;
    } else if (columnInfo.getColumnType().getSqlType() == Types.TIMESTAMP) {
      calendar = Calendar.getInstance(timeZone);
    } else {
      calendar = Calendar.getInstance();
    }

    Timestamp tt;
    synchronized (calendar) {
      calendar.clear();
      calendar.set(year, month - 1, day, hour, minutes, seconds);
      tt = new Timestamp(calendar.getTimeInMillis());
    }
    tt.setNanos(microseconds * 1000);
    return tt;
  }
29778
public void setTimeZone(final TimeZone timezone) {
        if (dates == null) {
            throw new UnsupportedOperationException(
                    "TimeZone is not applicable to current value");
        }
        this.timeZone = timezone;
        if (timezone != null) {
            if (!Value.DATE_TIME.equals(getDates().getType())) {
                throw new UnsupportedOperationException(
                        "TimeZone is not applicable to current value");
            }
            dates.setTimeZone(timezone);
            getParameters().remove(getParameter(Parameter.TZID));
            final TzId tzId = new TzId(timezone.getID());
            getParameters().replace(tzId);
        } else {
            // use setUtc() to reset timezone..
            setUtc(false);
        }
    }
1237970
public final void setTimeZone(final TimeZone timezone) {
        getStart().setUtc(false);
        getStart().setTimeZone(timezone);
        getEnd().setUtc(false);
        getEnd().setTimeZone(timezone);
    }
931744
private boolean isHourInnerCircle(int hourOfDay) {
        // We'll have the 00 hours on the outside circle.
        boolean isMorning = hourOfDay <= 12 && hourOfDay != 0;
        // In the version 2 layout the circles are swapped
        if (mController.getVersion() != TimePickerDialog.Version.VERSION_1) isMorning = !isMorning;
        return mIs24HourMode && isMorning;
    }
1098340
public void setHideTime(boolean enable, final boolean useDarkTheme) {
        if(enable && !shouldHideTime) {
            // hide the time spinner and show a button to show it instead
            timeSpinner.setVisibility(GONE);
            ImageButton timeButton = (ImageButton) LayoutInflater.from(getContext()).inflate(R.layout.time_button, null);
            timeButton.setImageResource(useDarkTheme ? R.drawable.ic_action_time_dark : R.drawable.ic_action_time_light);
            timeButton.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
                    setHideTime(false, useDarkTheme);
                }
            });
            this.addView(timeButton);
        } else if(!enable && shouldHideTime) {
            timeSpinner.setVisibility(VISIBLE);
            this.removeViewAt(2);
        }
        shouldHideTime = enable;
    }
630704
private void init(final ZonedDateTime TIME) {
        time                    = new ObjectPropertyBase<ZonedDateTime>(TIME) {
            @Override protected void invalidated() {
                if (!isRunning() && isAnimated()) {
                    long animationDuration = getAnimationDuration();
                    timeline.stop();
                    final KeyValue KEY_VALUE = new KeyValue(currentTime, TIME.toEpochSecond());
                    final KeyFrame KEY_FRAME = new KeyFrame(javafx.util.Duration.millis(animationDuration), KEY_VALUE);
                    timeline.getKeyFrames().setAll(KEY_FRAME);
                    timeline.setOnFinished(e -> fireUpdateEvent(FINISHED_EVENT));
                    timeline.play();
                } else {
                    currentTime.set(TIME.toEpochSecond());
                    fireUpdateEvent(FINISHED_EVENT);
                }
            }
            @Override public Object getBean() { return Clock.this; }
            @Override public String getName() { return "time"; }
        };
        currentTime             = new LongPropertyBase(time.get().toEpochSecond()) {
            @Override protected void invalidated() {}
            @Override public Object getBean() { return Clock.this; }
            @Override public String getName() { return "currentTime"; }
        };
        zoneId                  = time.get().getZone();
        timeline                = new Timeline();
        timeline.setOnFinished(e -> fireUpdateEvent(FINISHED_EVENT));
        updateInterval          = LONG_INTERVAL;
        _checkSectionsForValue  = false;
        _checkAreasForValue     = false;
        sections                = FXCollections.observableArrayList();
        _secondsVisible         = false;
        _highlightSections      = false;
        areas                   = FXCollections.observableArrayList();
        _areasVisible           = false;
        _highlightAreas         = false;
        _text                   = "";
        _discreteSeconds        = true;
        _discreteMinutes        = true;
        _discreteHours          = false;
        _secondsVisible         = false;
        _titleVisible           = false;
        _textVisible            = false;
        _dateVisible            = false;
        _dayVisible             = false;
        _nightMode              = false;
        _running                = false;
        _autoNightMode          = false;
        _backgroundPaint        = Color.TRANSPARENT;
        _borderPaint            = Color.TRANSPARENT;
        _borderWidth            = 1;
        _foregroundPaint        = Color.TRANSPARENT;
        _titleColor             = DARK_COLOR;
        _textColor              = DARK_COLOR;
        _dateColor              = DARK_COLOR;
        _hourTickMarkColor      = DARK_COLOR;
        _minuteTickMarkColor    = DARK_COLOR;
        _tickLabelColor         = DARK_COLOR;
        _alarmColor             = DARK_COLOR;
        _hourTickMarksVisible   = true;
        _minuteTickMarksVisible = true;
        _tickLabelsVisible      = true;
        _hourColor              = DARK_COLOR;
        _minuteColor            = DARK_COLOR;
        _secondColor            = DARK_COLOR;
        _knobColor              = DARK_COLOR;
        _lcdDesign              = LcdDesign.STANDARD;
        _alarmsEnabled          = false;
        _alarmsVisible          = false;
        alarms                  = FXCollections.observableArrayList();
        alarmsToRemove          = new ArrayList<>();
        _lcdCrystalEnabled      = false;
        _shadowsEnabled         = false;
        _lcdFont                = LcdFont.DIGITAL_BOLD;
        _locale                 = Locale.US;
        _tickLabelLocation      = TickLabelLocation.INSIDE;
        _animated               = false;
        animationDuration       = 10000;
        _customFontEnabled      = false;
        _customFont             = Fonts.robotoRegular(12);
    }