+ if (handler)
+ handler->timeout();
+}
+
+
+timeval BTimer::timeRemaining(const timeval &tm) const {
+ timeval ret = endpoint();
+
+ ret.tv_sec -= tm.tv_sec;
+ ret.tv_usec -= tm.tv_usec;
+
+ return normalizeTimeval(ret);
+}
+
+
+timeval BTimer::endpoint(void) const {
+ timeval ret;
+
+ ret.tv_sec = _start.tv_sec + _timeout.tv_sec;
+ ret.tv_usec = _start.tv_usec + _timeout.tv_usec;
+
+ return normalizeTimeval(ret);
+}
+
+
+bool BTimer::shouldFire(const timeval &tm) const {
+ timeval end = endpoint();
+
+ return ! ((tm.tv_sec < end.tv_sec) ||
+ (tm.tv_sec == end.tv_sec && tm.tv_usec < end.tv_usec));