diff options
-rw-r--r-- | src/FbTk/Timer.cc | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/FbTk/Timer.cc b/src/FbTk/Timer.cc index 773ef07..44ea69a 100644 --- a/src/FbTk/Timer.cc +++ b/src/FbTk/Timer.cc | |||
@@ -45,8 +45,6 @@ | |||
45 | #include <assert.h> | 45 | #include <assert.h> |
46 | #endif | 46 | #endif |
47 | 47 | ||
48 | #include <string.h> | ||
49 | |||
50 | namespace FbTk { | 48 | namespace FbTk { |
51 | 49 | ||
52 | Timer::TimerList Timer::m_timerlist; | 50 | Timer::TimerList Timer::m_timerlist; |
@@ -124,7 +122,9 @@ void Timer::updateTimers(int fd) { | |||
124 | FD_SET(fd, &rfds); | 122 | FD_SET(fd, &rfds); |
125 | 123 | ||
126 | bool overdue = false; | 124 | bool overdue = false; |
127 | 125 | ||
126 | // see, if the first timer in the | ||
127 | // list is overdue | ||
128 | if (!m_timerlist.empty()) { | 128 | if (!m_timerlist.empty()) { |
129 | gettimeofday(&now, 0); | 129 | gettimeofday(&now, 0); |
130 | 130 | ||
@@ -155,8 +155,11 @@ void Timer::updateTimers(int fd) { | |||
155 | timeout = &tm; | 155 | timeout = &tm; |
156 | } | 156 | } |
157 | 157 | ||
158 | // if not overdue, wait for the next xevent via the blocking | ||
159 | // select(), so OS sends fluxbox to sleep. the select() will | ||
160 | // time out when the next timer has to be handled | ||
158 | if (!overdue && select(fd + 1, &rfds, 0, 0, timeout) != 0) | 161 | if (!overdue && select(fd + 1, &rfds, 0, 0, timeout) != 0) |
159 | // didn't time out! x events pending | 162 | // didn't time out! x events are pending |
160 | return; | 163 | return; |
161 | 164 | ||
162 | TimerList::iterator it; | 165 | TimerList::iterator it; |
@@ -168,7 +171,7 @@ void Timer::updateTimers(int fd) { | |||
168 | // so we have to adjust the start_time | 171 | // so we have to adjust the start_time |
169 | static time_t last_time = 0; | 172 | static time_t last_time = 0; |
170 | if (now.tv_sec < last_time) { | 173 | if (now.tv_sec < last_time) { |
171 | 174 | ||
172 | time_t delta = last_time - now.tv_sec; | 175 | time_t delta = last_time - now.tv_sec; |
173 | 176 | ||
174 | for (it = m_timerlist.begin(); it != m_timerlist.end(); it++) { | 177 | for (it = m_timerlist.begin(); it != m_timerlist.end(); it++) { |