bool LX200SS2000PC::updateTime(ln_date * utc, double utc_offset) { bool result = true; // This method is largely identical to the one in the LX200Generic class. // The difference is that it ensures that updates that require planetary // data to be recomputed by the SkySensor2000PC are only done when really // necessary because this takes quite some time. if (!isSimulation()) { result = false; struct ln_zonedate ltm; ln_date_to_zonedate(utc, <m, static_cast<long>(utc_offset*3600.0+0.5)); DEBUGF(INDI::Logger::DBG_DEBUG, "New zonetime is %04d-%02d-%02d %02d:%02d:%06.3f (offset=%ld)", ltm.years, ltm.months, ltm.days, ltm.hours, ltm.minutes, ltm.seconds, ltm.gmtoff); JD = ln_get_julian_day(utc); DEBUGF(INDI::Logger::DBG_DEBUG, "New JD is %f", JD); if (setLocalTime(PortFD, ltm.hours, ltm.minutes, static_cast<int>(ltm.seconds+0.5)) < 0) { DEBUG(INDI::Logger::DBG_ERROR, "Error setting local time."); } else if (!setCalenderDate(ltm.years, ltm.months, ltm.days)) { DEBUG(INDI::Logger::DBG_ERROR, "Error setting local date."); } // Meade defines UTC Offset as the offset ADDED to local time to yield UTC, which // is the opposite of the standard definition of UTC offset! else if (!setUTCOffset(-static_cast<int>(utc_offset))) { DEBUG(INDI::Logger::DBG_ERROR, "Error setting UTC Offset."); } else { DEBUG(INDI::Logger::DBG_SESSION, "Time updated."); result = true; } } return result; }
void KstSettingsDlgI::setSettings(const KstSettings *settings) { _timer->setValue(settings->plotUpdateTimer); _fontSize->setValue(settings->plotFontSize); _fontMinSize->setValue(settings->plotFontMinSize); _colors->setBackground(settings->backgroundColor); _colors->setForeground(settings->foregroundColor); _promptPlotDelete->setChecked(settings->promptPlotDelete); _promptWindowClose->setChecked(settings->promptWindowClose); _showQuickStart->setChecked(settings->showQuickStart); _tiedZoomGlobal->setChecked(settings->tiedZoomGlobal); _xMajorGrid->setChecked(settings->xMajor); _yMajorGrid->setChecked(settings->yMajor); _xMinorGrid->setChecked(settings->xMinor); _yMinorGrid->setChecked(settings->yMinor); _majorGridColor->setColor(settings->majorColor); _minorGridColor->setColor(settings->minorColor); _checkBoxDefaultMajorGridColor->setChecked(settings->majorGridColorDefault); _checkBoxDefaultMinorGridColor->setChecked(settings->minorGridColorDefault); _checkBoxXInterpret->setChecked(settings->xAxisInterpret); _comboBoxXInterpret->setCurrentItem(settings->xAxisInterpretation); _comboBoxXDisplay->setCurrentItem(settings->xAxisDisplay); _spinBoxLineWidth->setValue(settings->defaultLineWeight); _lineEditSender->setText(settings->emailSender); _lineEditHost->setText(settings->emailSMTPServer); _lineEditLogin->setText(settings->emailUsername); _lineEditPassword->setText(settings->emailPassword); _kIntSpinBoxEMailPort->setValue(settings->emailSMTPPort); _checkBoxAuthentication->setChecked(settings->emailRequiresAuthentication); _buttonGroupEncryption->setButton((int)settings->emailEncryption); _buttonGroupAuthentication->setButton((int)settings->emailAuthentication); _tz->setTimezone(settings->timezone); setUTCOffset(settings->timezone); _colorPalette->refresh(settings->curveColorSequencePalette); }
bool LX200GPS::updateTime(ln_date *utc, double utc_offset) { ln_zonedate ltm; if (isSimulation()) return true; JD = ln_get_julian_day(utc); DEBUGF(INDI::Logger::DBG_DEBUG, "New JD is %f", (float)JD); ln_date_to_zonedate(utc, <m, utc_offset * 3600); DEBUGF(INDI::Logger::DBG_DEBUG, "Local time is %02d:%02d:%02g", ltm.hours, ltm.minutes, ltm.seconds); // Set Local Time if (setLocalTime(PortFD, ltm.hours, ltm.minutes, ltm.seconds) < 0) { DEBUG(INDI::Logger::DBG_ERROR, "Error setting local time time."); return false; } if (setCalenderDate(PortFD, utc->days, utc->months, utc->years) < 0) { DEBUG(INDI::Logger::DBG_ERROR, "Error setting UTC date."); return false; } // Meade defines UTC Offset as the offset ADDED to local time to yield UTC, which // is the opposite of the standard definition of UTC offset! if (setUTCOffset(PortFD, (utc_offset * -1.0)) < 0) { DEBUG(INDI::Logger::DBG_ERROR, "Error setting UTC Offset."); return false; } DEBUG(INDI::Logger::DBG_SESSION, "Time updated, updating planetary data..."); return true; }
void KstSettingsDlg::updateUTCOffset() { setUTCOffset(_tz->tzName()); }