Diffstat (limited to 'noncore/settings/networksettings/interface.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/interface.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/settings/networksettings/interface.cpp b/noncore/settings/networksettings/interface.cpp index b9b09ad..f6eed00 100644 --- a/noncore/settings/networksettings/interface.cpp +++ b/noncore/settings/networksettings/interface.cpp | |||
@@ -174,49 +174,49 @@ bool Interface::refresh(){ | |||
174 | pid = line.toInt(); | 174 | pid = line.toInt(); |
175 | } | 175 | } |
176 | file.close(); | 176 | file.close(); |
177 | 177 | ||
178 | if( pid == -1){ | 178 | if( pid == -1){ |
179 | qDebug("Interface: Could not get pid of dhcpc deamon."); | 179 | qDebug("Interface: Could not get pid of dhcpc deamon."); |
180 | return false; | 180 | return false; |
181 | } | 181 | } |
182 | 182 | ||
183 | // Get the start running time of the deamon | 183 | // Get the start running time of the deamon |
184 | fileName = (QString("/proc/%1/stat").arg(pid)); | 184 | fileName = (QString("/proc/%1/stat").arg(pid)); |
185 | file.setName(fileName); | 185 | file.setName(fileName); |
186 | stream.setDevice( &file ); | 186 | stream.setDevice( &file ); |
187 | if (!file.open(IO_ReadOnly)){ | 187 | if (!file.open(IO_ReadOnly)){ |
188 | qDebug(QString("Interface: Can't open file: %1").arg(fileName).latin1()); | 188 | qDebug(QString("Interface: Can't open file: %1").arg(fileName).latin1()); |
189 | return false; | 189 | return false; |
190 | } | 190 | } |
191 | while ( !stream.eof() ) { | 191 | while ( !stream.eof() ) { |
192 | line = stream.readLine(); | 192 | line = stream.readLine(); |
193 | } | 193 | } |
194 | file.close(); | 194 | file.close(); |
195 | long time = 0; | 195 | long time = 0; |
196 | // Grab the start time | 196 | // Grab the start time |
197 | // pid com state ppid pgrp session tty_nr tpgid flags | 197 | // pid com state ppid pgrp session tty_nr tpgid flags |
198 | int r = sscanf(line.latin1(), "%*d %*s %*c %*d %*d %*d %*d %*d %*u " | 198 | sscanf(line.latin1(), "%*d %*s %*c %*d %*d %*d %*d %*d %*u " |
199 | // minflt cminflt majflt cmajflt utime stime cutime cstime priority | 199 | // minflt cminflt majflt cmajflt utime stime cutime cstime priority |
200 | "%*u %*u %*u %*u %*u %*u %*d %*d %*d " | 200 | "%*u %*u %*u %*u %*u %*u %*d %*d %*d " |
201 | // nice 0 itrealvalue starttime | 201 | // nice 0 itrealvalue starttime |
202 | "%*d %*d %*d %lu", (long*) &time); | 202 | "%*d %*d %*d %lu", (long*) &time); |
203 | time = time/100; | 203 | time = time/100; |
204 | 204 | ||
205 | QDateTime datetime(QDateTime::currentDateTime()); | 205 | QDateTime datetime(QDateTime::currentDateTime()); |
206 | 206 | ||
207 | // Get the uptime of the computer. | 207 | // Get the uptime of the computer. |
208 | QFile f("/proc/uptime"); | 208 | QFile f("/proc/uptime"); |
209 | if ( f.open(IO_ReadOnly) ) { // file opened successfully | 209 | if ( f.open(IO_ReadOnly) ) { // file opened successfully |
210 | QTextStream t( &f ); // use a text stream | 210 | QTextStream t( &f ); // use a text stream |
211 | int sec = 0; | 211 | int sec = 0; |
212 | t >> sec; | 212 | t >> sec; |
213 | datetime = datetime.addSecs((-1*sec)); | 213 | datetime = datetime.addSecs((-1*sec)); |
214 | f.close(); | 214 | f.close(); |
215 | } | 215 | } |
216 | else{ | 216 | else{ |
217 | qDebug("Interface: Can't open /proc/uptime to retrive uptime."); | 217 | qDebug("Interface: Can't open /proc/uptime to retrive uptime."); |
218 | return false; | 218 | return false; |
219 | } | 219 | } |
220 | 220 | ||
221 | datetime = datetime.addSecs(time); | 221 | datetime = datetime.addSecs(time); |
222 | //qDebug(QString("Interface: %1 %2").arg(datetime.toString()).arg(pid).latin1()); | 222 | //qDebug(QString("Interface: %1 %2").arg(datetime.toString()).arg(pid).latin1()); |