Fix regression: switch back to microseconds for DelayCmd
This commit is contained in:
parent
59d097bcea
commit
2f279e96b1
2 changed files with 12 additions and 8 deletions
|
@ -239,21 +239,21 @@ Command<void> *DelayedCmd::parse(const std::string &command,
|
|||
if (cmd == 0)
|
||||
return 0;
|
||||
|
||||
int delay = 200;
|
||||
StringUtil::fromString<int>(args.c_str() + err, delay);
|
||||
uint64_t delay = 200;
|
||||
StringUtil::fromString<uint64_t>(args.c_str() + err, delay);
|
||||
|
||||
return new DelayedCmd(cmd, delay);
|
||||
}
|
||||
|
||||
REGISTER_COMMAND_PARSER(delay, DelayedCmd::parse, void);
|
||||
|
||||
DelayedCmd::DelayedCmd(const RefCount<Slot<void> > &cmd, unsigned int timeout) {
|
||||
DelayedCmd::DelayedCmd(const RefCount<Slot<void> > &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);
|
||||
}
|
||||
|
||||
|
|
|
@ -85,15 +85,19 @@ private:
|
|||
uint64_t m_timeout; ///< time length in microseconds
|
||||
};
|
||||
|
||||
|
||||
|
||||
/// executes a command after a specified timeout
|
||||
class DelayedCmd: public Command<void> {
|
||||
public:
|
||||
DelayedCmd(const RefCount<Slot<void> > &cmd, unsigned int timeout = 200);
|
||||
|
||||
// timeout in microseconds
|
||||
DelayedCmd(const RefCount<Slot<void> > &cmd, uint64_t timeout = 200);
|
||||
|
||||
// this constructor has inverted order of parameters to avoid ambiguity with the previous
|
||||
// constructor
|
||||
template<typename Functor>
|
||||
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<void> *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;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue