From 2f279e96b16b40ac8f1aa0b9850dd13f7ec4d0ae Mon Sep 17 00:00:00 2001 From: Mathias Gumz Date: Fri, 14 Sep 2012 08:51:42 +0200 Subject: Fix regression: switch back to microseconds for DelayCmd --- src/FbTk/Timer.cc | 10 +++++----- src/FbTk/Timer.hh | 10 +++++++--- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/FbTk/Timer.cc b/src/FbTk/Timer.cc index 38f1a32..b9d089f 100644 --- a/src/FbTk/Timer.cc +++ b/src/FbTk/Timer.cc @@ -239,21 +239,21 @@ Command *DelayedCmd::parse(const std::string &command, if (cmd == 0) return 0; - int delay = 200; - StringUtil::fromString(args.c_str() + err, delay); + uint64_t delay = 200; + StringUtil::fromString(args.c_str() + err, delay); return new DelayedCmd(cmd, delay); } REGISTER_COMMAND_PARSER(delay, DelayedCmd::parse, void); -DelayedCmd::DelayedCmd(const RefCount > &cmd, unsigned int timeout) { +DelayedCmd::DelayedCmd(const RefCount > &cmd, uint64_t timeout) { initTimer(timeout); m_timer.setCommand(cmd); } -void DelayedCmd::initTimer(unsigned int timeout) { - m_timer.setTimeout(timeout * FbTime::IN_MILLISECONDS); +void DelayedCmd::initTimer(uint64_t timeout) { + m_timer.setTimeout(timeout); m_timer.fireOnce(true); } diff --git a/src/FbTk/Timer.hh b/src/FbTk/Timer.hh index 241e327..bdaf3b8 100644 --- a/src/FbTk/Timer.hh +++ b/src/FbTk/Timer.hh @@ -85,15 +85,19 @@ private: uint64_t m_timeout; ///< time length in microseconds }; + + /// executes a command after a specified timeout class DelayedCmd: public Command { public: - DelayedCmd(const RefCount > &cmd, unsigned int timeout = 200); + + // timeout in microseconds + DelayedCmd(const RefCount > &cmd, uint64_t timeout = 200); // this constructor has inverted order of parameters to avoid ambiguity with the previous // constructor template - DelayedCmd(unsigned int timeout, const Functor &functor) { + DelayedCmd(uint64_t timeout, const Functor &functor) { initTimer(timeout); m_timer.setFunctor(functor); } @@ -102,7 +106,7 @@ public: static Command *parse(const std::string &command, const std::string &args, bool trusted); private: - void initTimer(unsigned int timeout); + void initTimer(uint64_t timeout); Timer m_timer; }; -- cgit v0.11.2