X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=otk%2Ftimer.hh;h=556475c19296a7828f6bb3314e246d0a20aa69d2;hb=1e58c863bbaddd2f2dbebfde740ca842e8837a1c;hp=e982d82bb4fa56c4313912eb8aa3baec8adc45c0;hpb=a388c41df485e6ac7cfb26231b7ac6be76e3522e;p=chaz%2Fopenbox diff --git a/otk/timer.hh b/otk/timer.hh index e982d82b..556475c1 100644 --- a/otk/timer.hh +++ b/otk/timer.hh @@ -7,16 +7,7 @@ */ extern "C" { -#ifdef TIME_WITH_SYS_TIME -# include -# include -#else // !TIME_WITH_SYS_TIME -# ifdef HAVE_SYS_TIME_H -# include -# else // !HAVE_SYS_TIME_H -# include -# endif // HAVE_SYS_TIME_H -#endif // TIME_WITH_SYS_TIME +#include } #include @@ -39,9 +30,12 @@ private: struct TimerCompare { //! Compares two timeval structs inline bool operator()(const Timer *a, const Timer *b) const { - return timercmp(&a->_timeout, &b->_timeout, >); + return ((&a->_timeout)->tv_sec == (&b->_timeout)->tv_sec) ? + ((&a->_timeout)->tv_usec > (&b->_timeout)->tv_usec) : + ((&a->_timeout)->tv_sec > (&b->_timeout)->tv_sec); } }; + friend struct TimerCompare; // give access to _timeout for shitty compilers typedef std::priority_queue, TimerCompare> TimerQ;