aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/FbTk/Timer.cc10
-rw-r--r--src/FbTk/Timer.hh10
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<void> *DelayedCmd::parse(const std::string &command,
239 if (cmd == 0) 239 if (cmd == 0)
240 return 0; 240 return 0;
241 241
242 int delay = 200; 242 uint64_t delay = 200;
243 StringUtil::fromString<int>(args.c_str() + err, delay); 243 StringUtil::fromString<uint64_t>(args.c_str() + err, delay);
244 244
245 return new DelayedCmd(cmd, delay); 245 return new DelayedCmd(cmd, delay);
246} 246}
247 247
248REGISTER_COMMAND_PARSER(delay, DelayedCmd::parse, void); 248REGISTER_COMMAND_PARSER(delay, DelayedCmd::parse, void);
249 249
250DelayedCmd::DelayedCmd(const RefCount<Slot<void> > &cmd, unsigned int timeout) { 250DelayedCmd::DelayedCmd(const RefCount<Slot<void> > &cmd, uint64_t timeout) {
251 initTimer(timeout); 251 initTimer(timeout);
252 m_timer.setCommand(cmd); 252 m_timer.setCommand(cmd);
253} 253}
254 254
255void DelayedCmd::initTimer(unsigned int timeout) { 255void DelayedCmd::initTimer(uint64_t timeout) {
256 m_timer.setTimeout(timeout * FbTime::IN_MILLISECONDS); 256 m_timer.setTimeout(timeout);
257 m_timer.fireOnce(true); 257 m_timer.fireOnce(true);
258} 258}
259 259
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:
85 uint64_t m_timeout; ///< time length in microseconds 85 uint64_t m_timeout; ///< time length in microseconds
86}; 86};
87 87
88
89
88/// executes a command after a specified timeout 90/// executes a command after a specified timeout
89class DelayedCmd: public Command<void> { 91class DelayedCmd: public Command<void> {
90public: 92public:
91 DelayedCmd(const RefCount<Slot<void> > &cmd, unsigned int timeout = 200); 93
94 // timeout in microseconds
95 DelayedCmd(const RefCount<Slot<void> > &cmd, uint64_t timeout = 200);
92 96
93 // this constructor has inverted order of parameters to avoid ambiguity with the previous 97 // this constructor has inverted order of parameters to avoid ambiguity with the previous
94 // constructor 98 // constructor
95 template<typename Functor> 99 template<typename Functor>
96 DelayedCmd(unsigned int timeout, const Functor &functor) { 100 DelayedCmd(uint64_t timeout, const Functor &functor) {
97 initTimer(timeout); 101 initTimer(timeout);
98 m_timer.setFunctor(functor); 102 m_timer.setFunctor(functor);
99 } 103 }
@@ -102,7 +106,7 @@ public:
102 static Command<void> *parse(const std::string &command, 106 static Command<void> *parse(const std::string &command,
103 const std::string &args, bool trusted); 107 const std::string &args, bool trusted);
104private: 108private:
105 void initTimer(unsigned int timeout); 109 void initTimer(uint64_t timeout);
106 110
107 Timer m_timer; 111 Timer m_timer;
108}; 112};