summaryrefslogtreecommitdiff
path: root/noncore/settings/netsystemtime/ntp.cpp
authortille <tille>2002-06-25 13:39:50 (UTC)
committer tille <tille>2002-06-25 13:39:50 (UTC)
commita3f1ec6a75ea762a54ed218f205956ca28d61599 (patch) (unidiff)
tree60d6911a808803dcfed90e7887a901c52b3443b0 /noncore/settings/netsystemtime/ntp.cpp
parent8501705e4e50602aaabe9877e6d8821555e3a05a (diff)
downloadopie-a3f1ec6a75ea762a54ed218f205956ca28d61599.zip
opie-a3f1ec6a75ea762a54ed218f205956ca28d61599.tar.gz
opie-a3f1ec6a75ea762a54ed218f205956ca28d61599.tar.bz2
doing something ;)
Diffstat (limited to 'noncore/settings/netsystemtime/ntp.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/netsystemtime/ntp.cpp50
1 files changed, 29 insertions, 21 deletions
diff --git a/noncore/settings/netsystemtime/ntp.cpp b/noncore/settings/netsystemtime/ntp.cpp
index ddb1372..87b20ec 100644
--- a/noncore/settings/netsystemtime/ntp.cpp
+++ b/noncore/settings/netsystemtime/ntp.cpp
@@ -34,4 +34,4 @@ Ntp::Ntp( QWidget* parent, const char* name, WFlags fl )
34 connect(PushButtonPredict, SIGNAL(clicked()), this, SLOT(preditctTime())); 34 connect(PushButtonPredict, SIGNAL(clicked()), this, SLOT(preditctTime()));
35 _nextCorrection = new QTimer( this ); 35 // _nextCorrection = new QTimer( this );
36 connect( _nextCorrection, SIGNAL(timeout()), SLOT(correctClock()) ); 36// connect( _nextCorrection, SIGNAL(timeout()), SLOT(correctClock()) );
37 slotRunNtp(); 37 slotRunNtp();
@@ -85,2 +85,4 @@ void Ntp::ntpFinished(OProcess*)
85 cfg.writeEntry("time", time); 85 cfg.writeEntry("time", time);
86 cfg.setGroup("correction");
87 cfg.writeEntry("time", time);
86 88
@@ -103,20 +105,24 @@ void Ntp::ntpFinished(OProcess*)
103 105
104void Ntp::correctClock() 106//void Ntp::correctClock()
105{ 107//{
106 qDebug("current time: %s",QDateTime::currentDateTime().toString().latin1()); 108 //qDebug("current time: %s",QDateTime::currentDateTime().toString().latin1());
107 Config cfg("ntp",Config::User); 109 //Config cfg("ntp",Config::User);
108 cfg.setGroup("correction"); 110// cfg.setGroup("correction");
109 int lastTime = cfg.readNumEntry("time",0); 111 // int lastTime = cfg.readNumEntry("time",0);
110 int now = TimeConversion::toUTC( QDateTime::currentDateTime() ); 112// if ( lastTime == 0 )
111 int corr = int((now - lastTime) * _shiftPerSec); 113// {
112 struct timeval myTv; 114 // return;
113 myTv.tv_sec = TimeConversion::toUTC( QDateTime::currentDateTime().addSecs(corr) ); 115// }
114 myTv.tv_usec = 0; 116// int now = TimeConversion::toUTC( QDateTime::currentDateTime() );
115 117// int corr = int((now - lastTime) * _shiftPerSec);
116 if ( myTv.tv_sec != -1 ) 118// struct timeval myTv;
117 ::settimeofday( &myTv, 0 ); 119// myTv.tv_sec = TimeConversion::toUTC( QDateTime::currentDateTime().addSecs(corr) );
118 Global::writeHWClock(); 120// myTv.tv_usec = 0;
119 cfg.writeEntry("time",now); 121//
120 qDebug("current time: %s",QDateTime::currentDateTime().toString().latin1()); 122// if ( myTv.tv_sec != -1 )
121} 123// ::settimeofday( &myTv, 0 );
124// Global::writeHWClock();
125// cfg.writeEntry("time",now);
126 //qDebug("current time: %s",QDateTime::currentDateTime().toString().latin1());
127//}
122 128
@@ -181,3 +187,5 @@ void Ntp::preditctTime()
181 int corr = int((now - lastTime) * _shiftPerSec); 187 int corr = int((now - lastTime) * _shiftPerSec);
182 TextLabelPredTime->setText(QDateTime::currentDateTime().addSecs(corr).toString()); 188 QDateTime dt = QDateTime::currentDateTime().addSecs(corr);
189 setTime(dt);
190 TextLabelPredTime->setText(dt.toString());
183} 191}