-rw-r--r-- | noncore/settings/netsystemtime/ntp.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/noncore/settings/netsystemtime/ntp.cpp b/noncore/settings/netsystemtime/ntp.cpp index 40b5531..0b13b6d 100644 --- a/noncore/settings/netsystemtime/ntp.cpp +++ b/noncore/settings/netsystemtime/ntp.cpp @@ -8,24 +8,25 @@ #include <qlineedit.h> #include <qspinbox.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 <sys/time.h> #include <time.h> #include <stdlib.h> Ntp::Ntp( QWidget* parent, const char* name, WFlags fl ) : SetDateTime( parent, name, fl ) { Config ntpSrvs(QPEApplication::qpeDir()+"etc/ntpservers",Config::File); ntpSrvs.setGroup("servers"); int srvCount = ntpSrvs.readNumEntry("count", 0 ); for (int i = 0; i < srvCount; i++) @@ -135,24 +136,31 @@ void Ntp::getNtpOutput(OProcess *proc, char *buffer, int buflen) } 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; + 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()); |