-rw-r--r-- | noncore/settings/netsystemtime/ntp.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/noncore/settings/netsystemtime/ntp.cpp b/noncore/settings/netsystemtime/ntp.cpp index aecefc1..f653cd0 100644 --- a/noncore/settings/netsystemtime/ntp.cpp +++ b/noncore/settings/netsystemtime/ntp.cpp @@ -12,24 +12,25 @@ #include <qlayout.h> #include <qmessagebox.h> #include <qmultilineedit.h> #include <opie/oprocess.h> #include <qpe/qpeapplication.h> #include <qpe/config.h> #include <qpe/global.h> #include <qpe/timeconversion.h> #include <qpe/tzselect.h> #include <qpe/timestring.h> #include <qpe/qpedialog.h> #include <qpe/datebookdb.h> +#include <qpe/datebookmonth.h> #include <qpe/qcopenvelope_qws.h> #include <sys/time.h> #include <time.h> #include <stdlib.h> Ntp::Ntp( QWidget* parent, const char* name, WFlags fl ) : SetDateTime( parent, name, fl ) { _interactive = false; Config ntpSrvs(QPEApplication::qpeDir()+"etc/ntpservers",Config::File); ntpSrvs.setGroup("servers"); @@ -214,24 +215,28 @@ void Ntp::ntpFinished(OProcess *p) 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")); + + dateButton->setDate( QDate::currentDate() ); + timeButton->setTime( QDateTime::currentDateTime() ); + 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); } |