From kde-panel-devel Sun Sep 23 21:42:51 2007 From: =?utf-8?q?R=C3=BCdiger_Hacke?= Date: Sun, 23 Sep 2007 21:42:51 +0000 To: kde-panel-devel Subject: [Panel-devel] [patch] datacontainer timestamp fix Message-Id: <200709232343.03452.rudwardt () gmx ! de> X-MARC-Message: https://marc.info/?l=kde-panel-devel&m=119058382827759 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--===============0559042010==" --===============0559042010== Content-Type: multipart/signed; boundary="nextPart1226244.Ky2Dz2UmVu"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit --nextPart1226244.Ky2Dz2UmVu Content-Type: multipart/mixed; boundary="Boundary-01=_b3t9G6l9yNlU06M" Content-Transfer-Encoding: 7bit Content-Disposition: inline --Boundary-01=_b3t9G6l9yNlU06M Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi, in Plasma::DataContainer you've got the following function: int DataContainer::timeSinceLastUpdate() const { int msec =3D QTime::currentTime().msec(); if (msec < d->updateTs) { // we wrapped over midnight here, so return the current // msec's plus the number of msec left in the previous day. // 86400000 is the # of msec in a day // // yes, we assume we don't wrap more than one day here. return msec + (86400000 - d->updateTs); } return msec - d->updateTs; } This won't work because QTime.msec() only returns the millisecond fraction = of=20 the time (0-999). I fell for exactly the same thing, thus I spotted it. See the attachment for one possibility to fix this. kind regards, Rudi --Boundary-01=_b3t9G6l9yNlU06M Content-Type: text/x-diff; charset="utf-8"; name="fix_timestamp.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="fix_timestamp.diff" Index: datacontainer.cpp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =2D-- datacontainer.cpp (Revision 716055) +++ datacontainer.cpp (Arbeitskopie) @@ -53,7 +53,7 @@ } =20 d->dirty =3D true; =2D d->updateTs =3D QTime::currentTime().msec(); + d->updateTs =3D QTime().msecsTo(QTime::currentTime()); } =20 void DataContainer::clearData() @@ -82,7 +82,7 @@ =20 int DataContainer::timeSinceLastUpdate() const { =2D int msec =3D QTime::currentTime().msec(); + int msec =3D QTime().msecsTo(QTime::currentTime()); if (msec < d->updateTs) { // we wrapped over midnight here, so return the current // msec's plus the number of msec left in the previous day. --Boundary-01=_b3t9G6l9yNlU06M-- --nextPart1226244.Ky2Dz2UmVu Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.6 (GNU/Linux) iD8DBQBG9t3nu1t1ffngHWoRAmt/AJ4grH8X8dozQAvDxyJ9IZacXfEZMgCfY2Jx SGQ/jj4/vBhhfe+6wnalcoc= =qVpH -----END PGP SIGNATURE----- --nextPart1226244.Ky2Dz2UmVu-- --===============0559042010== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Panel-devel mailing list Panel-devel@kde.org https://mail.kde.org/mailman/listinfo/panel-devel --===============0559042010==--