[Panel-devel] [patch] datacontainer timestamp fix

Rüdiger Hacke rudwardt at gmx.de
Sun Sep 23 23:42:51 CEST 2007


Hi,

in Plasma::DataContainer you've got the following function:

int DataContainer::timeSinceLastUpdate() const
{
    int msec = 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 
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix_timestamp.diff
Type: text/x-diff
Size: 699 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/panel-devel/attachments/20070923/a108d57d/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/panel-devel/attachments/20070923/a108d57d/attachment.pgp 


More information about the Panel-devel mailing list