-rw-r--r-- | noncore/settings/netsystemtime/ntp.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/noncore/settings/netsystemtime/ntp.cpp b/noncore/settings/netsystemtime/ntp.cpp index 6c5aaf5..9572993 100644 --- a/noncore/settings/netsystemtime/ntp.cpp +++ b/noncore/settings/netsystemtime/ntp.cpp @@ -110,98 +110,98 @@ void Ntp::slotRunNtp() "<br>"+tr("Rerun NTP?"), QMessageBox::Ok,QMessageBox::Cancel) ) { case QMessageBox::Ok: break; case QMessageBox::Cancel: return; default: return; } } TextLabelStartTime->setText(QDateTime::currentDateTime().toString()); ntpOutPut( tr("Running:")+"\nntpdate "+getNtpServer() ); ntpProcess->clearArguments(); *ntpProcess << "ntpdate" << getNtpServer(); bool ret = ntpProcess->start(OProcess::NotifyOnExit,OProcess::AllOutput); if ( !ret ) { qDebug("Error while executing ntpdate"); ntpOutPut( tr("Error while executing ntpdate")); } } void Ntp::getNtpOutput(OProcess *proc, char *buffer, int buflen) { QString lineStr, lineStrOld; lineStr = buffer; lineStr=lineStr.left(buflen); if (lineStr!=lineStrOld) { ntpOutPut(lineStr); _ntpOutput += lineStr; } lineStrOld = lineStr; } void Ntp::ntpFinished(OProcess *p) { qDebug("p->exitStatus() %i",p->exitStatus()); if (p->exitStatus()!=0 || !p->normalExit()) { slotProbeNtpServer(); return; } Global::writeHWClock(); // since time has changed quickly load in the datebookdb // to allow the alarm server to get a better grip on itself // (example re-trigger alarms for when we travel back in time) DateBookDB db; - QCopEnvelope timeApplet( "QPE/TaskBar", "reloadApplets()" ); - timeApplet << ""; +// QCopEnvelope timeApplet( "QPE/TaskBar", "reloadApplets()" ); +// timeApplet << ""; Config cfg("ntp",Config::User); cfg.setGroup("lookups"); int lastLookup = cfg.readNumEntry("time",0); int lookupCount = cfg.readNumEntry("count",0); bool lastNtp = cfg.readBoolEntry("lastNtp",false); int time = TimeConversion::toUTC( QDateTime::currentDateTime() ); cfg.writeEntry("time", time); float timeShift = getTimeShift(); if (timeShift == 0.0) return; int secsSinceLast = time - lastLookup; TextLabelNewTime->setText(QDateTime::currentDateTime().toString()); TextLabelTimeShift->setText(QString::number(timeShift)+tr(" seconds")); if ( lastNtp && lastLookup > 0 && secsSinceLast > 60* SpinBoxMinLookupDelay->value()) { cfg.setGroup("lookup_"+QString::number(lookupCount)); lookupCount++; _shiftPerSec = timeShift / secsSinceLast; qDebug("secs since last lookup %i", secsSinceLast);qDebug("timeshift since last lookup %f", timeShift);qDebug("timeshift since per sec %f", _shiftPerSec); cfg.writeEntry("secsSinceLast",secsSinceLast); cfg.writeEntry("timeShift",QString::number(timeShift)); cfg.setGroup("lookups"); cfg.writeEntry("count",lookupCount); cfg.writeEntry("lastNtp",true); } } float Ntp::getTimeShift() { QString _offset = "offset"; QString _sec = "sec"; QRegExp _reOffset = QRegExp(_offset); QRegExp _reEndOffset = QRegExp(_sec); int posOffset = _reOffset.match( _ntpOutput ); int posEndOffset = _reEndOffset.match( _ntpOutput, posOffset ); posOffset += _offset.length() + 1; QString diff = _ntpOutput.mid(posOffset, posEndOffset-posOffset-1); qDebug("%s", _ntpOutput.latin1()); qDebug("diff = >%s<",diff.latin1()); return diff.toFloat(); } void Ntp::readLookups() { Config cfg("ntp",Config::User); cfg.setGroup("lookups"); @@ -284,49 +284,49 @@ void Ntp::slotCheckNtp(int i) } } void Ntp::slotProbeNtpServer() { qDebug("Ntp::slotProbeNtpServer()"); ntpSock->connectToHost( getNtpServer() ,123); } void Ntp::slotNtpDelayChanged(int delay) { ntpTimer->changeInterval( delay*1000*60 ); } void Ntp::ntpOutPut(QString out) { MultiLineEditntpOutPut->append(out); MultiLineEditntpOutPut->setCursorPosition(MultiLineEditntpOutPut->numLines() + 1,0,FALSE); } void Ntp::makeChannel() { channel = new QCopChannel( "QPE/Application/netsystemtime", this ); connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), this, SLOT(receive(const QCString&, const QByteArray&)) ); } void Ntp::receive(const QCString &msg, const QByteArray &arg) { qDebug("QCop(Ntp) "+msg+" "+QCString(arg)); if ( msg == "ntpLookup(QString)" ) { slotRunNtp(); } if ( msg == "setPredictedTime(QString)" ) { setPredictTime(); }else{ qDebug("Ntp::receive: Huh what do ya want"); } } void Ntp::setDocument(const QString &fileName) { -}
\ No newline at end of file +} |