st
simple terminal
git clone https://9o.is/git/st.git
commit 8cae4d8c9deae7934a2289b083fb48a9150f88ed parent 54a56963de63dfba58819103a0f1d5e13629155c Author: Rob Pilling <rob@egbert> Date: Wed, 19 Jun 2013 21:24:01 +0100 Fixed lock up when system time jumps backwards Signed-off-by: Christoph Lohmann <20h@r-36.net> Diffstat:
| M | st.c | | | 7 | +++++-- |
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/st.c b/st.c @@ -3687,6 +3687,8 @@ run(void) { gettimeofday(&last, NULL); for(xev = actionfps;;) { + long deltatime; + FD_ZERO(&rfd); FD_SET(cmdfd, &rfd); FD_SET(xfd, &rfd); @@ -3720,8 +3722,9 @@ run(void) { gettimeofday(&lastblink, NULL); dodraw = 1; } - if(TIMEDIFF(now, last) \ - > (xev? (1000/xfps) : (1000/actionfps))) { + deltatime = TIMEDIFF(now, last); + if(deltatime > (xev? (1000/xfps) : (1000/actionfps)) + || deltatime < 0) { dodraw = 1; last = now; }