author | tille <tille> | 2002-06-25 13:09:08 (UTC) |
---|---|---|
committer | tille <tille> | 2002-06-25 13:09:08 (UTC) |
commit | 8501705e4e50602aaabe9877e6d8821555e3a05a (patch) (side-by-side diff) | |
tree | 3f34b6d0f8b7f7e692ccbefd91356685c322204f /noncore/settings/netsystemtime/ntp.cpp | |
parent | d282b4f9cba20305e237910aca531b0360666f13 (diff) | |
download | opie-8501705e4e50602aaabe9877e6d8821555e3a05a.zip opie-8501705e4e50602aaabe9877e6d8821555e3a05a.tar.gz opie-8501705e4e50602aaabe9877e6d8821555e3a05a.tar.bz2 |
included systemtime gui
not yet much funtionaliti
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 @@ -17,9 +17,9 @@ #include <stdlib.h> Ntp::Ntp( QWidget* parent, const char* name, WFlags fl ) - : NtpBase( parent, name, fl ) + : SetDateTime( parent, name, fl ) { Config cfg("ntp",Config::User); cfg.setGroup("settings"); _maxOffset = cfg.readNumEntry("maxOffset",5); @@ -39,8 +39,13 @@ Ntp::Ntp( QWidget* parent, const char* name, WFlags fl ) } Ntp::~Ntp() { + +} + +void Ntp::accept() +{ Config cfg("ntp",Config::User); cfg.setGroup("settings"); cfg.writeEntry("ntpServer", LineEditNtpServer->text()); } @@ -53,9 +58,8 @@ void Ntp::slotRunNtp() *ntpProcess << "ntpdate" << LineEditNtpServer->text(); bool ret = ntpProcess->start(OProcess::NotifyOnExit,OProcess::AllOutput); if ( !ret ) { qDebug("Error while executing ntp"); - outPut->append("\nError while executing\n\n"); } } void Ntp::getNtpOutput(OProcess *proc, char *buffer, int buflen) @@ -64,9 +68,9 @@ void Ntp::getNtpOutput(OProcess *proc, char *buffer, int buflen) lineStr = buffer; lineStr=lineStr.left(buflen); if (lineStr!=lineStrOld) { - outPut->append(lineStr); +// outPut->append(lineStr); _ntpOutput += lineStr; } lineStrOld = lineStr; } @@ -89,9 +93,9 @@ void Ntp::ntpFinished(OProcess*) lookupCount++; cfg.writeEntry("count",lookupCount); 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); cfg.writeEntry("timeShift",QString::number(timeShift)); } @@ -104,9 +108,8 @@ void Ntp::correctClock() cfg.setGroup("correction"); int lastTime = cfg.readNumEntry("time",0); 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) ); myTv.tv_usec = 0; @@ -172,9 +175,9 @@ void Ntp::preditctTime() qDebug("current time: %s",QDateTime::currentDateTime().toString().latin1()); Config cfg("ntp",Config::User); 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()); } |