diff options
author | Rob Pilling <rob@egbert> | 2013-06-19 21:24:01 +0100 |
---|---|---|
committer | Christoph Lohmann <20h@r-36.net> | 2013-10-27 13:17:11 +0100 |
commit | 489982d4b8442af25a380f8c22be542055cda81f (patch) | |
tree | 86e4edad182749ae8d0645f8652286057809fbfb /st.c | |
parent | 0f6942cdf6f8220f1ecd06e4b398e95c43833d44 (diff) | |
download | st-489982d4b8442af25a380f8c22be542055cda81f.tar.gz |
Fixed lock up when system time jumps backwards
Signed-off-by: Christoph Lohmann <20h@r-36.net>
Diffstat (limited to 'st.c')
-rw-r--r-- | st.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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; } |