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 | |
parent | 0f6942cdf6f8220f1ecd06e4b398e95c43833d44 (diff) | |
download | st-patched-489982d4b8442af25a380f8c22be542055cda81f.tar.bz2 st-patched-489982d4b8442af25a380f8c22be542055cda81f.tar.xz st-patched-489982d4b8442af25a380f8c22be542055cda81f.zip |
Fixed lock up when system time jumps backwards
Signed-off-by: Christoph Lohmann <20h@r-36.net>
-rw-r--r-- | st.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -3687,6 +3687,8 @@ run(void) { | |||
3687 | gettimeofday(&last, NULL); | 3687 | gettimeofday(&last, NULL); |
3688 | 3688 | ||
3689 | for(xev = actionfps;;) { | 3689 | for(xev = actionfps;;) { |
3690 | long deltatime; | ||
3691 | |||
3690 | FD_ZERO(&rfd); | 3692 | FD_ZERO(&rfd); |
3691 | FD_SET(cmdfd, &rfd); | 3693 | FD_SET(cmdfd, &rfd); |
3692 | FD_SET(xfd, &rfd); | 3694 | FD_SET(xfd, &rfd); |
@@ -3720,8 +3722,9 @@ run(void) { | |||
3720 | gettimeofday(&lastblink, NULL); | 3722 | gettimeofday(&lastblink, NULL); |
3721 | dodraw = 1; | 3723 | dodraw = 1; |
3722 | } | 3724 | } |
3723 | if(TIMEDIFF(now, last) \ | 3725 | deltatime = TIMEDIFF(now, last); |
3724 | > (xev? (1000/xfps) : (1000/actionfps))) { | 3726 | if(deltatime > (xev? (1000/xfps) : (1000/actionfps)) |
3727 | || deltatime < 0) { | ||
3725 | dodraw = 1; | 3728 | dodraw = 1; |
3726 | last = now; | 3729 | last = now; |
3727 | } | 3730 | } |