diff options
| author | Dana Jansens <danakj@orodu.net> | 2002-11-04 06:06:13 +0000 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2002-11-04 06:06:13 +0000 |
| commit | 7ebccbf39a02d4185b09728c5d55910742d926ff (patch) | |
| tree | a4923f8d4b23efa65e0d388f4c92eaa7603de1dd /otk/timer.cc | |
| parent | 578bedc2898951c5e86e85a54a556730cfc4fe5a (diff) | |
new OBTimer interface
Diffstat (limited to 'otk/timer.cc')
| -rw-r--r-- | otk/timer.cc | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/otk/timer.cc b/otk/timer.cc index 3f1afea0..c8e91262 100644 --- a/otk/timer.cc +++ b/otk/timer.cc @@ -35,17 +35,17 @@ static timeval normalizeTimeval(const timeval &tm) OBTimer::OBTimer(OBTimerQueueManager *m, OBTimeoutHandler h, OBTimeoutData d) { - manager = m; - handler = h; - data = d; + _manager = m; + _handler = h; + _data = d; - recur = timing = false; + _recur = _timing = false; } OBTimer::~OBTimer(void) { - if (timing) stop(); + if (_timing) stop(); } @@ -68,33 +68,33 @@ void OBTimer::start(void) { gettimeofday(&_start, 0); - if (! timing) { - timing = true; - manager->addTimer(this); + if (! _timing) { + _timing = true; + _manager->addTimer(this); } } void OBTimer::stop(void) { - if (timing) { - timing = false; + if (_timing) { + _timing = false; - manager->removeTimer(this); + _manager->removeTimer(this); } } -void OBTimer::fireTimeout(void) +void OBTimer::fire(void) { - if (handler) - handler(data); + if (_handler) + _handler(_data); } -timeval OBTimer::timeRemaining(const timeval &tm) const +timeval OBTimer::remainingTime(const timeval &tm) const { - timeval ret = endpoint(); + timeval ret = endTime(); ret.tv_sec -= tm.tv_sec; ret.tv_usec -= tm.tv_usec; @@ -103,7 +103,7 @@ timeval OBTimer::timeRemaining(const timeval &tm) const } -timeval OBTimer::endpoint(void) const +timeval OBTimer::endTime(void) const { timeval ret; @@ -116,7 +116,7 @@ timeval OBTimer::endpoint(void) const bool OBTimer::shouldFire(const timeval &tm) const { - timeval end = endpoint(); + timeval end = endTime(); return ! ((tm.tv_sec < end.tv_sec) || (tm.tv_sec == end.tv_sec && tm.tv_usec < end.tv_usec)); |
