Fix bug in wrapper re: sessions idle for more than 2^31 microseconds

This commit is contained in:
Keith Winstein
2011-02-22 05:46:49 -05:00
parent dea7f99d63
commit 507e791888
+3 -3
View File
@@ -133,11 +133,11 @@ bool tick( Terminal::Emulator *e )
perror( "gettimeofday" ); perror( "gettimeofday" );
} }
int diff = 1000000 * (this_time.tv_sec - last_time.tv_sec) double diff = (this_time.tv_sec - last_time.tv_sec)
+ (this_time.tv_usec - last_time.tv_usec); + .000001 * (this_time.tv_usec - last_time.tv_usec);
if ( (!initialized) if ( (!initialized)
|| (diff >= 20000) ) { || (diff >= 0.02) ) {
std::string update = e->new_frame(); std::string update = e->new_frame();
swrite( STDOUT_FILENO, update.c_str() ); swrite( STDOUT_FILENO, update.c_str() );
initialized = true; initialized = true;