summaryrefslogtreecommitdiff
path: root/noncore/settings/netsystemtime
authortille <tille>2002-06-27 22:28:03 (UTC)
committer tille <tille>2002-06-27 22:28:03 (UTC)
commit2f9c9f9dfe6aff27381a3c671bbd50870976677c (patch) (side-by-side diff)
tree28ea446384f0abc3b8c9b49d9631b46bd174b32d /noncore/settings/netsystemtime
parent49710f20cf0e52ea3393027ed066f11e977e3457 (diff)
downloadopie-2f9c9f9dfe6aff27381a3c671bbd50870976677c.zip
opie-2f9c9f9dfe6aff27381a3c671bbd50870976677c.tar.gz
opie-2f9c9f9dfe6aff27381a3c671bbd50870976677c.tar.bz2
conffile count
Diffstat (limited to 'noncore/settings/netsystemtime') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/netsystemtime/ntp.cpp9
-rw-r--r--noncore/settings/netsystemtime/settime.cpp3
2 files changed, 8 insertions, 4 deletions
diff --git a/noncore/settings/netsystemtime/ntp.cpp b/noncore/settings/netsystemtime/ntp.cpp
index 830c0c3..7971f9a 100644
--- a/noncore/settings/netsystemtime/ntp.cpp
+++ b/noncore/settings/netsystemtime/ntp.cpp
@@ -148,25 +148,25 @@ 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);
- cfg.setGroup("correction");
- 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 ( lastLookup > 0 && secsSinceLast > 60* SpinBoxMinLookupDelay->value())
+ if ( lastNtp && lastLookup > 0 && secsSinceLast > 60* SpinBoxMinLookupDelay->value())
{
+ cfg.setGroup("lookup_"+QString::number(lookupCount));
lookupCount++;
cfg.writeEntry("count",lookupCount);
- cfg.setGroup("lookup_"+QString::number(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.writeEntry("lastNtp",true);
}
}
@@ -228,6 +228,7 @@ void Ntp::preditctTime()
Config cfg("ntp",Config::User);
cfg.setGroup("lookups");
int lastTime = cfg.readNumEntry("time",0);
+ cfg.writeEntry("lastNtp",true);
setenv( "TZ", tz->currentZone(), 1 );
int now = TimeConversion::toUTC( QDateTime::currentDateTime() );
int corr = int((now - lastTime) * _shiftPerSec);
diff --git a/noncore/settings/netsystemtime/settime.cpp b/noncore/settings/netsystemtime/settime.cpp
index e7e604f..9c5323a 100644
--- a/noncore/settings/netsystemtime/settime.cpp
+++ b/noncore/settings/netsystemtime/settime.cpp
@@ -230,6 +230,9 @@ void SetDateTime::writeSettings()
void SetDateTime::commitTime()
{
+ Config cfg("ntp",Config::User);
+ cfg.setGroup("lookups");
+ cfg.writeEntry("lastNtp",false);
tz->setFocus();
// Need to process the QCOP event generated above before proceeding
qApp->processEvents();