Opened 12 years ago

Closed 10 years ago

#3437 closed patch (fixed)

Sametime 7.5 idle times too high by exactly 2^32 milliseconds

Reported by: lpm Owned by: siege
Milestone: 2.5.3 Component: Sametime
Version: 2.2.1 Keywords: idle time
Cc:

Description

The patch to correctly display idle time from Sametime 7.5 users works beautifully, except that some sametime 7.5 users show an idle time too high by about 49 days.

Upon investigation, it appears the idle time of a Sametime 7.5 user is either good or too high by 232 milliseconds. Which leads me to believe that there is a 64-bit integer used where a 32-bit unsigned integer should have been used somewhere in the sametime idle computation code in pidgin.

Example: a sametime 7.5 user would be shown as idle for 1193 hours and 28 minutes (about 4296480000 milliseconds, a quantity bigger than 232) whereas in reality this user is idle for 25 minutes (about 1512000 milliseconds).

Change History (7)

comment:1 Changed 12 years ago by jroper2

I can confirm this bug, I notice in most cases, it's fine, but some users, both Sametime 7.5 and 7.5.1 users, are being reported as being idle by an offset of 49 days, 17 hours and almost 3 minutes.

comment:2 Changed 11 years ago by ReD-BaRoN

I have this same problem. Is anyone working on this fix?

comment:3 Changed 11 years ago by lpm

I looked at the code in libpurple/protocols/sametime/sametime.c and the debug logs and I think I know what the problem is... The problem is that we substract the idle timestamp reported by the buddy from the current (local) time. The problem is that our clock and the buddy's clock are not synchronized, and if the buddy's clock is running fast, the result may be negative. Since we're doing 32-bit unsigned arithmetic, we end up with something close to 232 milliseconds.

An easy workaround would be to test if the timestamp from the buddy is in the future, and if so assume zero idle time.

In other words, I suggest replacing:

ugly_idle_len = ((time(NULL) * 1000) - idle) / 1000;

by:

ugly_idle_len = time(NULL) * 1000 ;
if (idle > ugly_idle_len) {
  ugly_idle_len = 0 ;
}
else {
  ugly_idle_len =- idle ;
  ugly_idle_len /= 1000 ;
}

comment:4 Changed 11 years ago by ReD-BaRoN

Great, so make it happen ;)!

comment:5 Changed 10 years ago by rekkanoryo

  • Type changed from defect to patch

This isn't a patch per se, but close enough...

comment:6 Changed 10 years ago by rekkanoryo

Ticket #6880 has been marked as a duplicate of this ticket.

comment:7 Changed 10 years ago by lpm+pidgin.im@…

  • Milestone set to 2.5.3
  • Resolution set to fixed
  • Status changed from new to closed

(In 52e2a425de43a95def135fff5a6dbe87ed39acb5):
Fix ludicrously long idle times for Sametime 7.5 buddies by assuming idle time is 0 if the idle timestamp from the buddy is in the future. Fixes #3437.

Note: See TracTickets for help on using tickets.
All information, including names and email addresses, entered onto this website or sent to mailing lists affiliated with this website will be public. Do not post confidential information, especially passwords!