summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/netsystemtime/ntp.cpp58
-rw-r--r--noncore/settings/netsystemtime/ntp.h4
-rw-r--r--noncore/settings/netsystemtime/ntpbase.ui4
-rw-r--r--noncore/settings/netsystemtime/opie-netsystemtime.control2
-rw-r--r--noncore/settings/netsystemtime/settime.cpp2
5 files changed, 41 insertions, 29 deletions
diff --git a/noncore/settings/netsystemtime/ntp.cpp b/noncore/settings/netsystemtime/ntp.cpp
index 364609d..bcbf7a1 100644
--- a/noncore/settings/netsystemtime/ntp.cpp
+++ b/noncore/settings/netsystemtime/ntp.cpp
@@ -35,25 +35,25 @@ Ntp::Ntp( QWidget* parent, const char* name, WFlags fl )
35 } 35 }
36 if ( srvCount==0 ) ComboNtpSrv->insertItem(tr("time.fu-berlin.de")); 36 if ( srvCount==0 ) ComboNtpSrv->insertItem(tr("time.fu-berlin.de"));
37 37
38 Config cfg("ntp",Config::User); 38 Config cfg("ntp",Config::User);
39 cfg.setGroup("settings"); 39 cfg.setGroup("settings");
40 // _maxOffset = cfg.readNumEntry("maxOffset",5); 40 // _maxOffset = cfg.readNumEntry("maxOffset",5);
41// _minLookupDiff = cfg.readNumEntry("minLookupDiff",10); 41// _minLookupDiff = cfg.readNumEntry("minLookupDiff",10);
42 SpinBoxMinLookupDelay->setValue( cfg.readNumEntry("minLookupDiff",41) ); 42 SpinBoxMinLookupDelay->setValue( cfg.readNumEntry("minLookupDiff",41) );
43 SpinBoxNtpDelay->setValue( cfg.readNumEntry("ntpRefreshFreq",42) ); 43 SpinBoxNtpDelay->setValue( cfg.readNumEntry("ntpRefreshFreq",42) );
44 ComboNtpSrv->setCurrentItem( cfg.readNumEntry("ntpServer", 0) ); 44 ComboNtpSrv->setCurrentItem( cfg.readNumEntry("ntpServer", 0) );
45 45
46 ntpTimer = new QTimer(this); 46 ntpTimer = new QTimer(this);
47 ntpTimer->start(SpinBoxNtpDelay->value()*100); 47 ntpTimer->start(SpinBoxNtpDelay->value()*1000*60);
48 48
49 ntpProcess = new OProcess( ); 49 ntpProcess = new OProcess( );
50 connect( SpinBoxNtpDelay, SIGNAL( valueChanged(int) ), 50 connect( SpinBoxNtpDelay, SIGNAL( valueChanged(int) ),
51 SLOT(slotNtpDelayChanged(int)) ); 51 SLOT(slotNtpDelayChanged(int)) );
52 52
53 ntpSock = new QSocket( this ); 53 ntpSock = new QSocket( this );
54 connect( ntpSock, SIGNAL( error(int) ), 54 connect( ntpSock, SIGNAL( error(int) ),
55 SLOT(slotCheckNtp(int)) ); 55 SLOT(slotCheckNtp(int)) );
56 slotProbeNtpServer(); 56 slotProbeNtpServer();
57 57
58 connect ( ntpProcess, SIGNAL(receivedStdout(OProcess*,char*,int)), 58 connect ( ntpProcess, SIGNAL(receivedStdout(OProcess*,char*,int)),
59 this, SLOT(getNtpOutput(OProcess*,char*,int))); 59 this, SLOT(getNtpOutput(OProcess*,char*,int)));
@@ -76,63 +76,72 @@ Ntp::~Ntp()
76 for (int i = 0; i < srvCount; i++) 76 for (int i = 0; i < srvCount; i++)
77 { 77 {
78 ntpSrvs.setGroup(QString::number(i)); 78 ntpSrvs.setGroup(QString::number(i));
79 ntpSrvs.writeEntry( "name", ComboNtpSrv->text(i) ); 79 ntpSrvs.writeEntry( "name", ComboNtpSrv->text(i) );
80 } 80 }
81 Config cfg("ntp",Config::User); 81 Config cfg("ntp",Config::User);
82 cfg.setGroup("settings"); 82 cfg.setGroup("settings");
83 cfg.writeEntry("ntpServer", ComboNtpSrv->currentItem()); 83 cfg.writeEntry("ntpServer", ComboNtpSrv->currentItem());
84 cfg.writeEntry( "minLookupDiff", SpinBoxMinLookupDelay->value() ); 84 cfg.writeEntry( "minLookupDiff", SpinBoxMinLookupDelay->value() );
85 cfg.writeEntry( "ntpRefreshFreq", SpinBoxNtpDelay->value() ); 85 cfg.writeEntry( "ntpRefreshFreq", SpinBoxNtpDelay->value() );
86} 86}
87 87
88 88bool Ntp::ntpDelayElapsed()
89void Ntp::slotRunNtp()
90{ 89{
91 Config cfg("ntp",Config::User); 90 Config cfg("ntp",Config::User);
92 cfg.setGroup("lookups"); 91 cfg.setGroup("lookups");
93 int lookupDiff = TimeConversion::toUTC(QDateTime::currentDateTime()) - cfg.readNumEntry("time",0); 92 _lookupDiff = TimeConversion::toUTC(QDateTime::currentDateTime()) - cfg.readNumEntry("time",0);
93 return (_lookupDiff - (SpinBoxNtpDelay->value()*60)) > -60;
94}
94 95
95 if ( lookupDiff < SpinBoxNtpDelay->value()*60 ) 96QString Ntp::getNtpServer()
97{
98 return ComboNtpSrv->currentText();
99}
100
101void Ntp::slotRunNtp()
102{
103 if ( !ntpDelayElapsed() )
96 { 104 {
97 switch ( 105 switch (
98 QMessageBox::warning(this, tr("Run ntp?"), 106 QMessageBox::warning(this, tr("Run NTP?"),
99 tr("You asked for a delay of ")+SpinBoxNtpDelay->text()+tr(" minutes, but only ")+ 107 tr("You asked for a delay of ")+SpinBoxNtpDelay->text()+tr(" minutes, but only ")+
100 QString::number(lookupDiff%60)+tr(" minutes elapsed since last loopup.")+ 108 QString::number(_lookupDiff/60)+tr(" minutes elapsed since last loopup.")+
101 "<br>"+tr("Rerun ntp?"), 109 "<br>"+tr("Rerun NTP?"),
102 QMessageBox::Ok,QMessageBox::Cancel) 110 QMessageBox::Ok,QMessageBox::Cancel)
103 ) { 111 ) {
104 case QMessageBox::Ok: break; 112 case QMessageBox::Ok: break;
105 case QMessageBox::Cancel: return; 113 case QMessageBox::Cancel: return;
106 default: return; 114 default: return;
107 } 115 }
108 } 116 }
109 TextLabelStartTime->setText(QDateTime::currentDateTime().toString()); 117 TextLabelStartTime->setText(QDateTime::currentDateTime().toString());
110 MultiLineEditntpOutPut->append( "\n"+tr("Running:")+"\nntpdate "+ ComboNtpSrv->currentText()+"\n"); 118 ntpOutPut( tr("Running:")+"\nntpdate "+getNtpServer() );
111 ntpProcess->clearArguments(); 119 ntpProcess->clearArguments();
112 *ntpProcess << "ntpdate" << ComboNtpSrv->currentText(); 120 *ntpProcess << "ntpdate" << getNtpServer();
113 bool ret = ntpProcess->start(OProcess::NotifyOnExit,OProcess::AllOutput); 121 bool ret = ntpProcess->start(OProcess::NotifyOnExit,OProcess::AllOutput);
114 if ( !ret ) { 122 if ( !ret ) {
115 qDebug("Error while executing ntp"); 123 qDebug("Error while executing ntpdate");
124 ntpOutPut( tr("Error while executing ntpdate"));
116 } 125 }
117} 126}
118 127
119void Ntp::getNtpOutput(OProcess *proc, char *buffer, int buflen) 128void Ntp::getNtpOutput(OProcess *proc, char *buffer, int buflen)
120{ 129{
121 QString lineStr, lineStrOld; 130 QString lineStr, lineStrOld;
122 lineStr = buffer; 131 lineStr = buffer;
123 lineStr=lineStr.left(buflen); 132 lineStr=lineStr.left(buflen);
124 if (lineStr!=lineStrOld) 133 if (lineStr!=lineStrOld)
125 { 134 {
126 MultiLineEditntpOutPut->append(lineStr); 135 ntpOutPut(lineStr);
127 _ntpOutput += lineStr; 136 _ntpOutput += lineStr;
128 } 137 }
129 lineStrOld = lineStr; 138 lineStrOld = lineStr;
130} 139}
131 140
132void Ntp::ntpFinished(OProcess*) 141void Ntp::ntpFinished(OProcess*)
133{ 142{
134 Config cfg("ntp",Config::User); 143 Config cfg("ntp",Config::User);
135 cfg.setGroup("lookups"); 144 cfg.setGroup("lookups");
136 int lastLookup = cfg.readNumEntry("time",0); 145 int lastLookup = cfg.readNumEntry("time",0);
137 int lookupCount = cfg.readNumEntry("count",-1); 146 int lookupCount = cfg.readNumEntry("count",-1);
138 int time = TimeConversion::toUTC( QDateTime::currentDateTime() ); 147 int time = TimeConversion::toUTC( QDateTime::currentDateTime() );
@@ -142,25 +151,24 @@ void Ntp::ntpFinished(OProcess*)
142 151
143 float timeShift = getTimeShift(); 152 float timeShift = getTimeShift();
144 if (timeShift == 0.0) return; 153 if (timeShift == 0.0) return;
145 int secsSinceLast = time - lastLookup; 154 int secsSinceLast = time - lastLookup;
146 TextLabelNewTime->setText(QDateTime::currentDateTime().toString()); 155 TextLabelNewTime->setText(QDateTime::currentDateTime().toString());
147 TextLabelTimeShift->setText(QString::number(timeShift)+tr(" seconds")); 156 TextLabelTimeShift->setText(QString::number(timeShift)+tr(" seconds"));
148 if ( lastLookup > 0 && secsSinceLast > 60* SpinBoxMinLookupDelay->value()) 157 if ( lastLookup > 0 && secsSinceLast > 60* SpinBoxMinLookupDelay->value())
149 { 158 {
150 lookupCount++; 159 lookupCount++;
151 cfg.writeEntry("count",lookupCount); 160 cfg.writeEntry("count",lookupCount);
152 cfg.setGroup("lookup_"+QString::number(lookupCount)); 161 cfg.setGroup("lookup_"+QString::number(lookupCount));
153 _shiftPerSec = timeShift / secsSinceLast; 162 _shiftPerSec = timeShift / secsSinceLast;
154// float nextCorr = _maxOffset / _shiftPerSec;
155 qDebug("secs since last lookup %i", secsSinceLast);qDebug("timeshift since last lookup %f", timeShift);qDebug("timeshift since per sec %f", _shiftPerSec); 163 qDebug("secs since last lookup %i", secsSinceLast);qDebug("timeshift since last lookup %f", timeShift);qDebug("timeshift since per sec %f", _shiftPerSec);
156 cfg.writeEntry("secsSinceLast",secsSinceLast); 164 cfg.writeEntry("secsSinceLast",secsSinceLast);
157 cfg.writeEntry("timeShift",QString::number(timeShift)); 165 cfg.writeEntry("timeShift",QString::number(timeShift));
158 } 166 }
159} 167}
160 168
161 169
162float Ntp::getTimeShift() 170float Ntp::getTimeShift()
163{ 171{
164 QString _offset = "offset"; 172 QString _offset = "offset";
165 QString _sec = "sec"; 173 QString _sec = "sec";
166 QRegExp _reOffset = QRegExp(_offset); 174 QRegExp _reOffset = QRegExp(_offset);
@@ -203,25 +211,24 @@ void Ntp::readLookups()
203 shiftPerSec = shift / last; 211 shiftPerSec = shift / last;
204 _shiftPerSec += shiftPerSec; 212 _shiftPerSec += shiftPerSec;
205 TableLookups->setText( i,0,QString::number(shiftPerSec)); 213 TableLookups->setText( i,0,QString::number(shiftPerSec));
206 TableLookups->setText( i,2,QString::number(shift)); 214 TableLookups->setText( i,2,QString::number(shift));
207 TableLookups->setText( i,1,QString::number(last)); 215 TableLookups->setText( i,1,QString::number(last));
208 } 216 }
209 _shiftPerSec /= lookupCount+1; 217 _shiftPerSec /= lookupCount+1;
210 TextLabelShift->setText(QString::number(_shiftPerSec)+tr(" seconds")); 218 TextLabelShift->setText(QString::number(_shiftPerSec)+tr(" seconds"));
211} 219}
212 220
213void Ntp::preditctTime() 221void Ntp::preditctTime()
214{ 222{
215 qDebug("current time: %s",QDateTime::currentDateTime().toString().latin1());
216 Config cfg("ntp",Config::User); 223 Config cfg("ntp",Config::User);
217 cfg.setGroup("lookups"); 224 cfg.setGroup("lookups");
218 int lastTime = cfg.readNumEntry("time",0); 225 int lastTime = cfg.readNumEntry("time",0);
219 setenv( "TZ", tz->currentZone(), 1 ); 226 setenv( "TZ", tz->currentZone(), 1 );
220 int now = TimeConversion::toUTC( QDateTime::currentDateTime() ); 227 int now = TimeConversion::toUTC( QDateTime::currentDateTime() );
221 int corr = int((now - lastTime) * _shiftPerSec); 228 int corr = int((now - lastTime) * _shiftPerSec);
222 TextLabelEstimatedShift->setText(QString::number(corr)+tr(" seconds")); 229 TextLabelEstimatedShift->setText(QString::number(corr)+tr(" seconds"));
223 predictedTime = QDateTime::currentDateTime().addSecs(corr); 230 predictedTime = QDateTime::currentDateTime().addSecs(corr);
224 TextLabelPredTime->setText(predictedTime.toString()); 231 TextLabelPredTime->setText(predictedTime.toString());
225 TextLabelMainPredTime->setText(tr("Predicted time:")+"<br><b>"+predictedTime.toString()+"</b>"); 232 TextLabelMainPredTime->setText(tr("Predicted time:")+"<br><b>"+predictedTime.toString()+"</b>");
226} 233}
227 234
@@ -229,44 +236,47 @@ void Ntp::setPredictTime()
229{ 236{
230 preditctTime(); 237 preditctTime();
231 setTime( predictedTime ); 238 setTime( predictedTime );
232} 239}
233 240
234void Ntp::slotCheckNtp(int i) 241void Ntp::slotCheckNtp(int i)
235{ 242{
236 if (i == 0) 243 if (i == 0)
237 { 244 {
238 TextLabelMainPredTime->hide(); 245 TextLabelMainPredTime->hide();
239 ButtonSetTime->setText( tr("Get time from network") ); 246 ButtonSetTime->setText( tr("Get time from network") );
240 connect( ButtonSetTime, SIGNAL(clicked()), SLOT(slotRunNtp()) ); 247 connect( ButtonSetTime, SIGNAL(clicked()), SLOT(slotRunNtp()) );
241 Config cfg("ntp",Config::User); 248 if ( ntpDelayElapsed() )
242 cfg.setGroup("lookups");
243 int lookupDiff = TimeConversion::toUTC(QDateTime::currentDateTime()) - cfg.readNumEntry("time",0);
244 if ( lookupDiff > SpinBoxNtpDelay->value()*60 )
245 { 249 {
250 slotRunNtp();
246 disconnect(ntpTimer, SIGNAL( timeout() ), this, SLOT(slotProbeNtpServer()) ); 251 disconnect(ntpTimer, SIGNAL( timeout() ), this, SLOT(slotProbeNtpServer()) );
247 connect(ntpTimer, SIGNAL( timeout() ), SLOT(slotRunNtp()) ); 252 connect(ntpTimer, SIGNAL( timeout() ), SLOT(slotRunNtp()) );
248 }else{ 253 }else{
249 disconnect(ntpTimer, SIGNAL( timeout() ), this, SLOT(slotRunNtp()) ); 254 disconnect(ntpTimer, SIGNAL( timeout() ), this, SLOT(slotRunNtp()) );
250 connect(ntpTimer, SIGNAL( timeout() ), SLOT(slotProbeNtpServer()) ); 255 connect(ntpTimer, SIGNAL( timeout() ), SLOT(slotProbeNtpServer()) );
251 } 256 }
252 }else{ 257 }else{
253 preditctTime(); 258 preditctTime();
254 ButtonSetTime->setText( tr("Set predicted time") ); 259 ButtonSetTime->setText( tr("Set predicted time") );
260 if (i>0)ntpOutPut(tr("Could not connect to server ")+getNtpServer());
255 connect( ButtonSetTime, SIGNAL(clicked()), SLOT(setPredictTime()) ); 261 connect( ButtonSetTime, SIGNAL(clicked()), SLOT(setPredictTime()) );
256 connect( ntpTimer, SIGNAL( timeout() ), SLOT(slotProbeNtpServer()) ); 262 connect( ntpTimer, SIGNAL( timeout() ), SLOT(slotProbeNtpServer()) );
257 } 263 }
264 //ntpTimer->start(SpinBoxNtpDelay->value()*1000*60);
258} 265}
259 266
260void Ntp::slotProbeNtpServer() 267void Ntp::slotProbeNtpServer()
261{ 268{
262 Config cfg("ntp",Config::User); 269 if ( ntpDelayElapsed() )
263 cfg.setGroup("lookups"); 270 ntpSock->connectToHost( getNtpServer() ,123);
264 int lookupDiff = TimeConversion::toUTC(QDateTime::currentDateTime()) - cfg.readNumEntry("time",0);
265 if ( lookupDiff > SpinBoxNtpDelay->value()*60 )
266 ntpSock->connectToHost( ComboNtpSrv->currentText() ,123);
267} 271}
268 272
269void Ntp::slotNtpDelayChanged(int delay) 273void Ntp::slotNtpDelayChanged(int delay)
270{ 274{
271 ntpTimer->changeInterval( delay*100 ); 275 ntpTimer->changeInterval( delay*1000*60 );
276}
277
278void Ntp::ntpOutPut(QString out)
279{
280 MultiLineEditntpOutPut->append(out);
281 MultiLineEditntpOutPut->setCursorPosition(MultiLineEditntpOutPut->numLines() + 1,0,FALSE);
272} 282}
diff --git a/noncore/settings/netsystemtime/ntp.h b/noncore/settings/netsystemtime/ntp.h
index 7cc309f..c78dc55 100644
--- a/noncore/settings/netsystemtime/ntp.h
+++ b/noncore/settings/netsystemtime/ntp.h
@@ -14,30 +14,34 @@ class Ntp : public SetDateTime
14 14
15public: 15public:
16 Ntp( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 16 Ntp( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
17 ~Ntp(); 17 ~Ntp();
18 18
19protected: 19protected:
20 QDateTime predictedTime; 20 QDateTime predictedTime;
21 21
22 22
23private: 23private:
24 QString _ntpOutput; 24 QString _ntpOutput;
25 float _shiftPerSec; 25 float _shiftPerSec;
26 int _lookupDiff;
26 OProcess *ntpProcess; 27 OProcess *ntpProcess;
27 QTimer *ntpTimer; 28 QTimer *ntpTimer;
28 QSocket *ntpSock; 29 QSocket *ntpSock;
29 30
30 float getTimeShift(); 31 float getTimeShift();
31 void readLookups(); 32 void readLookups();
33 void ntpOutPut(QString);
34 bool ntpDelayElapsed();
35 QString getNtpServer();
32private slots: 36private slots:
33 void slotRunNtp(); 37 void slotRunNtp();
34 void getNtpOutput(OProcess *proc, char *buffer, int buflen); 38 void getNtpOutput(OProcess *proc, char *buffer, int buflen);
35 void ntpFinished(OProcess*); 39 void ntpFinished(OProcess*);
36 void preditctTime(); 40 void preditctTime();
37 void slotCheckNtp(int); 41 void slotCheckNtp(int);
38 void setPredictTime(); 42 void setPredictTime();
39 void slotProbeNtpServer(); 43 void slotProbeNtpServer();
40 void slotNtpDelayChanged(int); 44 void slotNtpDelayChanged(int);
41}; 45};
42 46
43#endif 47#endif
diff --git a/noncore/settings/netsystemtime/ntpbase.ui b/noncore/settings/netsystemtime/ntpbase.ui
index 4e10fd2..a83dc93 100644
--- a/noncore/settings/netsystemtime/ntpbase.ui
+++ b/noncore/settings/netsystemtime/ntpbase.ui
@@ -2,26 +2,26 @@
2<class>NtpBase</class> 2<class>NtpBase</class>
3<widget> 3<widget>
4 <class>QWidget</class> 4 <class>QWidget</class>
5 <property stdset="1"> 5 <property stdset="1">
6 <name>name</name> 6 <name>name</name>
7 <cstring>NtpBase</cstring> 7 <cstring>NtpBase</cstring>
8 </property> 8 </property>
9 <property stdset="1"> 9 <property stdset="1">
10 <name>geometry</name> 10 <name>geometry</name>
11 <rect> 11 <rect>
12 <x>0</x> 12 <x>0</x>
13 <y>0</y> 13 <y>0</y>
14 <width>331</width> 14 <width>328</width>
15 <height>426</height> 15 <height>411</height>
16 </rect> 16 </rect>
17 </property> 17 </property>
18 <property stdset="1"> 18 <property stdset="1">
19 <name>caption</name> 19 <name>caption</name>
20 <string>Network Time</string> 20 <string>Network Time</string>
21 </property> 21 </property>
22 <property> 22 <property>
23 <name>layoutMargin</name> 23 <name>layoutMargin</name>
24 </property> 24 </property>
25 <property> 25 <property>
26 <name>layoutSpacing</name> 26 <name>layoutSpacing</name>
27 </property> 27 </property>
diff --git a/noncore/settings/netsystemtime/opie-netsystemtime.control b/noncore/settings/netsystemtime/opie-netsystemtime.control
index 406d7b0..d3290e9 100644
--- a/noncore/settings/netsystemtime/opie-netsystemtime.control
+++ b/noncore/settings/netsystemtime/opie-netsystemtime.control
@@ -1,11 +1,11 @@
1Files: bin/netsystemtime apps/Settings/ntpdatetime.desktop 1Files: bin/netsystemtime apps/Settings/ntpdatetime.desktop etc/ntpservers
2Priority: optional 2Priority: optional
3Section: opie/settings 3Section: opie/settings
4Depends: ntpdate 4Depends: ntpdate
5Conflicts: opie-systemtime 5Conflicts: opie-systemtime
6Maintainer: Patrick S. Vogt <tille@handhelds.org> 6Maintainer: Patrick S. Vogt <tille@handhelds.org>
7Architecture: arm 7Architecture: arm
8Version: $QPE_VERSION-$SUB_VERSION 8Version: $QPE_VERSION-$SUB_VERSION
9Depends: opie-base ($QPE_VERSION), ntpdate 9Depends: opie-base ($QPE_VERSION), ntpdate
10Description: ntp ( Network Time Protocol) gui 10Description: ntp ( Network Time Protocol) gui
11This utility syncs system time with a atomic timerserver via internet 11This utility syncs system time with a atomic timerserver via internet
diff --git a/noncore/settings/netsystemtime/settime.cpp b/noncore/settings/netsystemtime/settime.cpp
index 2398c08..93543cd 100644
--- a/noncore/settings/netsystemtime/settime.cpp
+++ b/noncore/settings/netsystemtime/settime.cpp
@@ -291,25 +291,24 @@ void SetDateTime::updateSystem(int i)
291 // Restore screensaver 291 // Restore screensaver
292 QCopEnvelope enableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" ); 292 QCopEnvelope enableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" );
293 enableScreenSaver << -1 << -1 << -1; 293 enableScreenSaver << -1 << -1 << -1;
294 // since time has changed quickly load in the datebookdb 294 // since time has changed quickly load in the datebookdb
295 // to allow the alarm server to get a better grip on itself 295 // to allow the alarm server to get a better grip on itself
296 // (example re-trigger alarms for when we travel back in time) 296 // (example re-trigger alarms for when we travel back in time)
297 DateBookDB db; 297 DateBookDB db;
298 298
299} 299}
300 300
301void SetDateTime::tzChange( const QString &tz ) 301void SetDateTime::tzChange( const QString &tz )
302{ 302{
303 qDebug("SetDateTime::tzChange");
304 // set the TZ get the time and leave gracefully... 303 // set the TZ get the time and leave gracefully...
305 QString strSave; 304 QString strSave;
306 strSave = getenv( "TZ" ); 305 strSave = getenv( "TZ" );
307 setenv( "TZ", tz, 1 ); 306 setenv( "TZ", tz, 1 );
308 307
309 QDate d = QDate::currentDate(); 308 QDate d = QDate::currentDate();
310 // reset the time. 309 // reset the time.
311 if ( !strSave.isNull() ) { 310 if ( !strSave.isNull() ) {
312 setenv( "TZ", strSave, 1 ); 311 setenv( "TZ", strSave, 1 );
313 } 312 }
314 dateButton->setDate( d ); 313 dateButton->setDate( d );
315 updateSystem(); 314 updateSystem();
@@ -447,25 +446,24 @@ void SetTime::checkedPM( int c )
447 int show_hour = sbHour->value(); 446 int show_hour = sbHour->value();
448 if (show_hour == 12) 447 if (show_hour == 12)
449 show_hour = 0; 448 show_hour = 0;
450 449
451 if ( c == ValuePM ) 450 if ( c == ValuePM )
452 show_hour += 12; 451 show_hour += 12;
453 452
454 hour = show_hour; 453 hour = show_hour;
455} 454}
456 455
457void SetTime::slotTzChange( const QString &tz ) 456void SetTime::slotTzChange( const QString &tz )
458{ 457{
459 qDebug("SetTime::slotTzChange");
460 // set the TZ get the time and leave gracefully... 458 // set the TZ get the time and leave gracefully...
461 QString strSave; 459 QString strSave;
462 strSave = getenv( "TZ" ); 460 strSave = getenv( "TZ" );
463 setenv( "TZ", tz, 1 ); 461 setenv( "TZ", tz, 1 );
464 462
465 QTime t = QTime::currentTime(); 463 QTime t = QTime::currentTime();
466 // reset the time. 464 // reset the time.
467 if ( !strSave.isNull() ) { 465 if ( !strSave.isNull() ) {
468 setenv( "TZ", strSave, 1 ); 466 setenv( "TZ", strSave, 1 );
469 } 467 }
470 468
471 // just set the spinboxes and let it propage through 469 // just set the spinboxes and let it propage through