Diffstat (limited to 'noncore/settings/netsystemtime/ntp.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/netsystemtime/ntp.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/noncore/settings/netsystemtime/ntp.cpp b/noncore/settings/netsystemtime/ntp.cpp index 04b113b..ddb1372 100644 --- a/noncore/settings/netsystemtime/ntp.cpp +++ b/noncore/settings/netsystemtime/ntp.cpp @@ -19,5 +19,5 @@ Ntp::Ntp( QWidget* parent, const char* name, WFlags fl ) - : NtpBase( parent, name, fl ) + : SetDateTime( parent, name, fl ) { Config cfg("ntp",Config::User); @@ -41,4 +41,9 @@ Ntp::Ntp( QWidget* parent, const char* name, WFlags fl ) Ntp::~Ntp() { + +} + +void Ntp::accept() +{ Config cfg("ntp",Config::User); cfg.setGroup("settings"); @@ -55,5 +60,4 @@ void Ntp::slotRunNtp() if ( !ret ) { qDebug("Error while executing ntp"); - outPut->append("\nError while executing\n\n"); } } @@ -66,5 +70,5 @@ void Ntp::getNtpOutput(OProcess *proc, char *buffer, int buflen) if (lineStr!=lineStrOld) { - outPut->append(lineStr); +// outPut->append(lineStr); _ntpOutput += lineStr; } @@ -91,5 +95,5 @@ void Ntp::ntpFinished(OProcess*) cfg.setGroup("lookup_"+QString::number(lookupCount)); _shiftPerSec = timeShift / secsSinceLast; - float nextCorr = _maxOffset / _shiftPerSec; +// float nextCorr = _maxOffset / _shiftPerSec; 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); @@ -106,5 +110,4 @@ void Ntp::correctClock() int now = TimeConversion::toUTC( QDateTime::currentDateTime() ); int corr = int((now - lastTime) * _shiftPerSec); - outPut->append( "time will be shifted by "+QString::number(corr)+ "secs"); struct timeval myTv; myTv.tv_sec = TimeConversion::toUTC( QDateTime::currentDateTime().addSecs(corr) ); @@ -174,7 +177,7 @@ void Ntp::preditctTime() cfg.setGroup("lookups"); int lastTime = cfg.readNumEntry("time",0); + setenv( "TZ", tz->currentZone(), 1 ); int now = TimeConversion::toUTC( QDateTime::currentDateTime() ); int corr = int((now - lastTime) * _shiftPerSec); - outPut->append( "time will be shifted by "+QString::number(corr)+ "secs"); TextLabelPredTime->setText(QDateTime::currentDateTime().addSecs(corr).toString()); } |