X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fcore%2Fsemaphore.cpp;h=8fa1be90f7c7e234abde3e74409bfb916acbffb9;hp=544fb27f81b192731f4175b97257f7b6e534268c;hb=03bacb2343eb5d17819732582c0866f087e9ce27;hpb=a1d6fa071280123f282c1bac3b68008672401024 diff --git a/source/core/semaphore.cpp b/source/core/semaphore.cpp index 544fb27..8fa1be9 100644 --- a/source/core/semaphore.cpp +++ b/source/core/semaphore.cpp @@ -1,16 +1,10 @@ -/* $Id$ - -This file is part of libmspcore -Copyright © 2006 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - #ifdef WIN32 #include #else #include #include #endif +#include #include #include #include @@ -92,11 +86,7 @@ bool Semaphore::wait(const Time::TimeDelta &d) throw system_error("Semaphore::wait"); return ret==WAIT_OBJECT_0; #else - Time::TimeStamp ts = Time::now()+d; - - timespec timeout; - timeout.tv_sec = ts.raw()/1000000; - timeout.tv_nsec = (ts.raw()%1000000)*1000; + timespec timeout = Time::rawtime_to_timespec((Time::now()+d).raw()); int err = pthread_cond_timedwait(&priv->cond, &priv->mutex.priv->mutex, &timeout); if(err && err!=ETIMEDOUT)