# HG changeset patch # User nenolod # Date 1137291576 28800 # Node ID d6051a60aae2aaae5776133f9402caa13e30c6e1 # Parent eb17963bc142f9776412e3b27c320ad317866555 [svn] Smarter algorithm for detecting differentials between button presses, now takes seconds into account. (I borrowed this from Atheme's lag detection code. :P) diff -r eb17963bc142 -r d6051a60aae2 audacious/mainwin.c --- a/audacious/mainwin.c Sat Jan 14 18:12:15 2006 -0800 +++ b/audacious/mainwin.c Sat Jan 14 18:19:36 2006 -0800 @@ -1935,14 +1935,15 @@ mainwin_rev_release(void) { GTimeVal now_time; + GTimeVal delta_time; glong now_dur; g_get_current_time(&now_time); - now_time.tv_usec *= now_time.tv_sec; - cb_time.tv_usec *= cb_time.tv_sec; - - now_dur = (now_time.tv_usec - cb_time.tv_usec) / 1000; + delta_time.tv_usec = now_time.tv_usec - cb_time.tv_usec; + delta_time.tv_sec = now_time.tv_sec - cb_time.tv_sec; + + now_dur = (delta_time.tv_sec * 1000) + (glong) (delta_time.tv_usec / 1000); if (now_dur <= 150 && now_dur >= -150) playlist_prev(); @@ -1962,14 +1963,15 @@ mainwin_fwd_release(void) { GTimeVal now_time; + GTimeVal delta_time; glong now_dur; g_get_current_time(&now_time); - now_time.tv_usec *= now_time.tv_sec; - cb_time.tv_usec *= cb_time.tv_sec; - - now_dur = (now_time.tv_usec - cb_time.tv_usec) / 1000; + delta_time.tv_usec = now_time.tv_usec - cb_time.tv_usec; + delta_time.tv_sec = now_time.tv_sec - cb_time.tv_sec; + + now_dur = (delta_time.tv_sec * 1000) + (glong) (delta_time.tv_usec / 1000); if (now_dur <= 150 && now_dur >= -150) playlist_next();