X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=otk%2Ftimer.hh;h=556475c19296a7828f6bb3314e246d0a20aa69d2;hb=1e58c863bbaddd2f2dbebfde740ca842e8837a1c;hp=1d93f9145c5178f50655ba680d013b147e94e709;hpb=96a9196cbb71b7f8d5e3d98a92b2e59bb1b591a8;p=chaz%2Fopenbox diff --git a/otk/timer.hh b/otk/timer.hh index 1d93f914..556475c1 100644 --- a/otk/timer.hh +++ b/otk/timer.hh @@ -7,21 +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 - -#ifdef HAVE_UNISTD_H -# include -# include -#endif // HAVE_UNISTD_H +#include } #include @@ -44,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;