Index: joe-3.5/tty.c =================================================================== --- joe-3.5.orig/tty.c +++ joe-3.5/tty.c @@ -242,18 +242,19 @@ void ttclose(void) } static int winched = 0; +int ticked = 0; #ifdef SIGWINCH /* Window size interrupt handler */ static RETSIGTYPE winchd(int unused) { ++winched; + ticked = 1; REINSTALL_SIGHANDLER(SIGWINCH, winchd); } #endif /* Second ticker */ -int ticked = 0; static RETSIGTYPE dotick(int unused) { ticked = 1; @@ -277,6 +278,8 @@ void tickon(void) { #ifdef HAVE_SETITIMER struct itimerval val; + struct timeval now; + gettimeofday(&now, NULL); val.it_interval.tv_sec = 0; val.it_interval.tv_usec = 0; if (auto_scroll) { @@ -287,8 +290,8 @@ void tickon(void) val.it_value.tv_sec = 0; val.it_value.tv_usec = tim; } else { - val.it_value.tv_sec = 1; - val.it_value.tv_usec = 0; + val.it_value.tv_sec = 60 - (now.tv_sec % 60); + val.it_value.tv_usec = 1000000 - now.tv_usec; } ticked = 0; joe_set_signal(SIGALRM, dotick);