X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=otk%2Ftimer.cc;h=2e2205f78fa0d960f58675fadb7fe1ed2e59a2eb;hb=52b83a9dbb2b7823d5f78781f5948dfd8d77d50b;hp=3f1afea069d7a4f36e1c2694f8b68ae50dc72e90;hpb=d0b55be2c7afb5b25b42804c9eab4995e64dff52;p=chaz%2Fopenbox diff --git a/otk/timer.cc b/otk/timer.cc index 3f1afea0..2e2205f7 100644 --- a/otk/timer.cc +++ b/otk/timer.cc @@ -1,4 +1,4 @@ -// -*- mode: C++; indent-tabs-mode: nil; -*- +// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*- #ifdef HAVE_CONFIG_H # include "../config.h" @@ -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));