Index: sources/view/settings/VDateTime.cpp =================================================================== diff -u -r611bbf4dcba67768db87cf30f21fd2db788f677d -r927113ed8827c44bbe40e0af952ac9b9683ac03b --- sources/view/settings/VDateTime.cpp (.../VDateTime.cpp) (revision 611bbf4dcba67768db87cf30f21fd2db788f677d) +++ sources/view/settings/VDateTime.cpp (.../VDateTime.cpp) (revision 927113ed8827c44bbe40e0af952ac9b9683ac03b) @@ -36,9 +36,23 @@ connect(&_process, SIGNAL( finished(int)), this, SLOT(onSetDateUIFinished(int))); + + connect(&_process, SIGNAL( errorOccurred(QProcess::ProcessError)), + this, SLOT(onSetDateUIErrored(QProcess::ProcessError))); } /*! + * \brief VDateTime::onSetDateUIErrored + * The slot for when the set datetime script errors, log the error + */ +void VDateTime::onSetDateUIErrored(QProcess::ProcessError error){ + QString mScript = Storage::Scripts_Path_Name(); + mScript += Storage::Date_Time_Set_Sh; + LOG_DEBUG(QString("%1 errored. Error %2").arg(mScript).arg(error)); + //DEBUG: qDebug()<< QString("%1 errored. Error ").arg(mScript) << error; +} + +/*! * \brief VDateTime::doCurrentTime * Reads and displays the current date and time */ @@ -77,25 +91,29 @@ hour ( vHour ); minute ( vMinute ); - const QDateTime currentDateTimeLocal ( QDate(_year .toInt() , - _month .toInt() , - _day .toInt()), - QTime(_hour .toInt() , - _minute .toInt())); + const QDateTime currentDateTimeLocal ( QDate(_year .toInt() , + _month .toInt() , + _day .toInt()) , + QTime(_hour .toInt() , + _minute .toInt())); const QString dateTimeLocalStr = currentDateTimeLocal.toString(_Settings.getDatetimeFormat()); // Get the current UTC datetime - QDateTime currentDateTimeUTC(currentDateTimeLocal); - currentDateTimeUTC.setTimeSpec(Qt::UTC); - const quint32 epochUTC_sec = currentDateTimeUTC.toSecsSinceEpoch(); + const QDateTime currentDateTimeUTC = currentDateTimeLocal.toUTC(); + const quint32 epochUTC_sec = currentDateTimeUTC.toSecsSinceEpoch(); LOG_DEBUG(tr("SetDateTime %1").arg(dateTimeLocalStr)); - status("Setting date and time ..."); - dateTimeUI(dateTimeLocalStr); + dateTimeUI(dateTimeLocalStr ); dateTimeHD(epochUTC_sec ); dateTimeDG(epochUTC_sec ); + + //DEBUG: QDateTime convertBack; + //DEBUG: convertBack.setSecsSinceEpoch(epochUTC_sec); + //DEBUG: qDebug()<<"Secs since Epoch" << convertBack.toSecsSinceEpoch() << " UTC: " << convertBack.toUTC().toString(_Settings.getDatetimeFormat()); + + //DEBUG: qDebug() << "doConfirm RTC | epoch : " << epochUTC_sec << " | local: " << currentDateTimeLocal.toString(_Settings.getDatetimeFormat()) << " | current time zone: " << currentDateTimeLocal.timeZone() << " | UTC: " << currentDateTimeUTC.toString(_Settings.getDatetimeFormat()) ; } /*! @@ -254,17 +272,14 @@ // Doing a single update of the HD-UI RTC sync on start-up static bool _hasDoneHDSyncRTC = false; if ( !_hasDoneHDSyncRTC ) { - QDateTime hdRTCTime; - hdRTCTime.setSecsSinceEpoch(vData.mEpoch); - hdRTCTime.setTimeSpec(Qt::UTC); + QDateTime hdRTCTime_localZone; // Default timespec is Qt::localTime / local time zoned + hdRTCTime_localZone.setSecsSinceEpoch(vData.mEpoch); - QDateTime localDateTime = hdRTCTime.toLocalTime(); - - QString newDateTimeString = localDateTime.toString(_Settings.getDatetimeFormat()); + const QString newDateTimeString = hdRTCTime_localZone.toString(_Settings.getDatetimeFormat()); dateTimeUI(newDateTimeString); - //DEBUG: qDebug() << "Sync HD-UI RTC | HD Epoch: " << vData.mEpoch << " | HD datetime: " << hdRTCTime.toString(_Settings.getDatetimeFormat()) <<" | datetime : " << newDateTimeString; - _hasDoneHDSyncRTC = true; // indicate HD-UI RTC sync'd + + //DEBUG: qDebug() << "Sync HD->UI RTC | HD Epoch: " << vData.mEpoch << " | HD datetime (local zone): " << hdRTCTime_localZone.toString(_Settings.getDatetimeFormat()) <<" | local datetime : " << newDateTimeString; } }