File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 1717#include <unistd.h>
1818
1919#define MAX_PANES 1024
20+ #define PANE_DELAY 1000
2021
2122struct pane {
2223 char * name ;
@@ -165,7 +166,7 @@ static void *rotate_panes(void *arg)
165166 fds [1 ].fd = ctx -> sync_fd_rx ;
166167 fds [1 ].events = POLLIN ;
167168
168- int sleep_time = 1000 ;
169+ int sleep_time = PANE_DELAY ;
169170
170171 size_t idx_increment = 1 ;
171172
@@ -203,14 +204,18 @@ static void *rotate_panes(void *arg)
203204 }
204205
205206 clock_gettime (CLOCK_MONOTONIC_RAW , & b );
206- int delta = (b .tv_nsec / 1000 / 1000 ) -
207+ int delta = (b .tv_sec - a .tv_sec ) * 1000 +
208+ (b .tv_nsec / 1000 / 1000 ) -
207209 (a .tv_nsec / 1000 / 1000 );
208210
209211 sleep_time -= delta ;
210- continue ;
212+ if (sleep_time < 0 ) {
213+ sleep_time = PANE_DELAY ;
214+ idx_increment = 1 ;
215+ }
211216 } else {
212217 idx_increment = 1 ;
213- sleep_time = 1000 ;
218+ sleep_time = PANE_DELAY ;
214219 }
215220 }
216221
You can’t perform that action at this time.
0 commit comments