From 507e791888a9b05ef11453c39b735df1f62243dd Mon Sep 17 00:00:00 2001 From: Keith Winstein Date: Tue, 22 Feb 2011 05:46:49 -0500 Subject: [PATCH] Fix bug in wrapper re: sessions idle for more than 2^31 microseconds --- termemu.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/termemu.cpp b/termemu.cpp index 4be7152..a7ecc9e 100644 --- a/termemu.cpp +++ b/termemu.cpp @@ -133,11 +133,11 @@ bool tick( Terminal::Emulator *e ) perror( "gettimeofday" ); } - int diff = 1000000 * (this_time.tv_sec - last_time.tv_sec) - + (this_time.tv_usec - last_time.tv_usec); + double diff = (this_time.tv_sec - last_time.tv_sec) + + .000001 * (this_time.tv_usec - last_time.tv_usec); if ( (!initialized) - || (diff >= 20000) ) { + || (diff >= 0.02) ) { std::string update = e->new_frame(); swrite( STDOUT_FILENO, update.c_str() ); initialized = true;