]> Dogcows Code - chaz/openbox/blobdiff - otk/timer.hh
alloc colors only when needed, and free them properly on destruction
[chaz/openbox] / otk / timer.hh
index 0ca8be8d83af025e12c44da48b6c5b255f4b4c05..556475c19296a7828f6bb3314e246d0a20aa69d2 100644 (file)
@@ -7,16 +7,7 @@
 */
 
 extern "C" {
-#ifdef    TIME_WITH_SYS_TIME
-#  include <sys/time.h>
-#  include <time.h>
-#else // !TIME_WITH_SYS_TIME
-#  ifdef    HAVE_SYS_TIME_H
-#    include <sys/time.h>
-#  else // !HAVE_SYS_TIME_H
-#    include <time.h>
-#  endif // HAVE_SYS_TIME_H
-#endif // TIME_WITH_SYS_TIME
+#include <ctime>
 }
 
 #include <queue>
@@ -39,7 +30,9 @@ 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
This page took 0.02347 seconds and 4 git commands to generate.