Version: cvs 20040110 (using KDE Devel) Installed from: Compiled sources Compiler: gcc332 OS: Linux with kde32 cvs snapshot 20040109 and current 20040110 kmldonkey cvs NEW ADDED downloads are shown with a negative age (-2147468000s) - old entries are shown with correct age - the age is shown correct via telnet or webaccess. i cannot speak for a stable release of kde31something as i only got a kde32cvs running here at the moment. rgds marc'O
Created attachment 4087 [details] screenshot
I'm getting the same thing here; seems like a recent kdelibs development, as it wasn't happening with CVS HEAD from a week or so ago and there's not been any changes in the relevant KMLDonkey code since then (or in mldonkey, for that matter). Will investigate as soon as time permits.
Subject: kdeextragear-2/kmldonkey/libkmldonkey CVS commit by pstokke: Worked around an mldonkey core bug. It seems that for time values over 0x40000000 (ie. last Saturday afternoon) the core starts sending out negative time values, which can be corrected by adding 0x80000000. This patch uses 0x7FFFFFFF just to avoid any signedness problems that might crop up (I'm paranoid about bad compilers), so the time will actually be one second off. You're welcome to sue. CCMAIL: 72355-done@bugs.kde.org M +9 -5 fileinfo.cpp 1.5 M +7 -4 fileinfo.h 1.4 --- kdeextragear-2/kmldonkey/libkmldonkey/fileinfo.cpp #1.4:1.5 @@ -101,7 +101,11 @@ void FileInfo::updateFileInfo(DonkeyMess j = msg->readInt16(); chunks_age.clear(); - for (i=0; i<j; i++) - chunks_age.append(msg->readFloat()); - age = msg->readFloat(); + for (i=0; i<j; i++) { + time_t a = (int)msg->readFloat(); + if (a < 0) a = 0x7fffffff + a; + chunks_age.append(a); + } + age = (time_t)msg->readFloat(); + if (age < 0) age = 0x7fffffff + age; format = msg->readInt8(); switch (format) { @@ -228,10 +232,10 @@ const double FileInfo::fileSpeed() const } -const QValueList<double>& FileInfo::fileChunksAge() const +const QValueList<time_t>& FileInfo::fileChunksAge() const { return chunks_age; } -const double FileInfo::fileAge() const +const time_t FileInfo::fileAge() const { return age; --- kdeextragear-2/kmldonkey/libkmldonkey/fileinfo.h #1.3:1.4 @@ -30,4 +30,7 @@ #include <qcstring.h> +#include <sys/types.h> +#include <time.h> + #include "donkeytypes.h" @@ -88,7 +91,7 @@ class FileInfo const double fileSpeed() const; //! The age of individual chunks. - const QValueList<double>& fileChunksAge() const; + const QValueList<time_t>& fileChunksAge() const; //! The time the download was started (seconds since Epoch). - const double fileAge() const; + const time_t fileAge() const; //! The file format. const int fileFormat() const; @@ -127,6 +130,6 @@ private: QMap<int,QByteArray> availability; double speed; - QValueList<double> chunks_age; - double age; + QValueList<time_t> chunks_age; + time_t age; int format; QString formatinfo;
Instead of testing for negative, then conditionally adding 0x7FFFFFFF, you can also just 'and' unconditionally with 0x7FFFFFFF. This will also prevent the one-second-off error... ;-)