diff options
Diffstat (limited to 'src/FbTk/Timer.cc')
-rw-r--r-- | src/FbTk/Timer.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/FbTk/Timer.cc b/src/FbTk/Timer.cc index 13bfc05..9b3fe8c 100644 --- a/src/FbTk/Timer.cc +++ b/src/FbTk/Timer.cc | |||
@@ -285,11 +285,15 @@ Command<void> *DelayedCmd::parse(const std::string &command, | |||
285 | REGISTER_COMMAND_PARSER(delay, DelayedCmd::parse, void); | 285 | REGISTER_COMMAND_PARSER(delay, DelayedCmd::parse, void); |
286 | 286 | ||
287 | DelayedCmd::DelayedCmd(const RefCount<Slot<void> > &cmd, unsigned int timeout) { | 287 | DelayedCmd::DelayedCmd(const RefCount<Slot<void> > &cmd, unsigned int timeout) { |
288 | timeval to; // defaults to 200ms | 288 | initTimer(timeout); |
289 | m_timer.setCommand(cmd); | ||
290 | } | ||
291 | |||
292 | void DelayedCmd::initTimer(unsigned int timeout) { | ||
293 | timeval to; | ||
289 | to.tv_sec = timeout/1000000; | 294 | to.tv_sec = timeout/1000000; |
290 | to.tv_usec = timeout % 1000000; | 295 | to.tv_usec = timeout % 1000000; |
291 | m_timer.setTimeout(to); | 296 | m_timer.setTimeout(to); |
292 | m_timer.setCommand(cmd); | ||
293 | m_timer.fireOnce(true); | 297 | m_timer.fireOnce(true); |
294 | } | 298 | } |
295 | 299 | ||