Remove LiveTV menu.
[vuplus_xbmc] / xbmc / threads / Condition.h
index bc8ad59..30359ac 100644 (file)
@@ -1,6 +1,6 @@
 /*
- *      Copyright (C) 2005-2011 Team XBMC
- *      http://www.xbmc.org
+ *      Copyright (C) 2005-2013 Team XBMC
+ *      http://xbmc.org
  *
  *  This Program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -13,9 +13,8 @@
  *  GNU General Public License for more details.
  *
  *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *  http://www.gnu.org/copyleft/gpl.html
+ *  along with XBMC; see the file COPYING.  If not, see
+ *  <http://www.gnu.org/licenses/>.
  *
  */
 
@@ -23,9 +22,7 @@
 
 #include "threads/platform/Condition.h"
 
-#include <boost/date_time/microsec_time_clock.hpp>
-#include <boost/date_time/posix_time/posix_time_types.hpp>
-
+#include "threads/SystemClock.h"
 #include <stdio.h>
 
 namespace XbmcThreads
@@ -46,14 +43,6 @@ namespace XbmcThreads
     ConditionVariable& cond;
     P predicate;
 
-    typedef boost::posix_time::ptime system_time;
-
-    inline static unsigned long timeLeft(const system_time& endtime)
-    {
-      long diff = (long)(endtime - boost::date_time::microsec_clock<system_time>::universal_time()).total_milliseconds();
-      return diff < 0 ? 0 : (unsigned long)diff;
-    }
-
   public:
     inline TightConditionVariable(ConditionVariable& cv, P predicate_) : cond(cv), predicate(predicate_) {}
 
@@ -63,12 +52,17 @@ namespace XbmcThreads
       bool ret = true;
       if (!predicate)
       {
-        system_time const endtime = boost::date_time::microsec_clock<system_time>::universal_time() + boost::posix_time::milliseconds(milliseconds);
-        bool notdone = true;
-        while (notdone && ret == true)
+        if (!milliseconds)
+        {
+          cond.wait(lock,milliseconds /* zero */);
+          return !(!predicate); // eh? I only require the ! operation on P
+        }
+        else
         {
-          cond.wait(lock,milliseconds);
-          ret = (notdone = (!predicate)) ? ((milliseconds = timeLeft(endtime)) != 0) : true;
+          EndTime endTime((unsigned int)milliseconds);
+          for (bool notdone = true; notdone && ret == true;
+               ret = (notdone = (!predicate)) ? ((milliseconds = endTime.MillisLeft()) != 0) : true)
+            cond.wait(lock,milliseconds);
         }
       }
       return ret;