[/ (C) Copyright 2007-8 Anthony Williams. Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt). ] [section:time Date and Time Requirements] As of Boost 1.35.0, the __boost_thread__ library uses the [link date_time Boost.Date_Time] library for all operations that require a time out. These include (but are not limited to): * __sleep__ * __timed_join__ * __cond_timed_wait__ * __timed_lock_ref__ For the overloads that accept an absolute time parameter, an object of type [link thread.time.system_time `boost::system_time`] is required. Typically, this will be obtained by adding a duration to the current time, obtained with a call to [link thread.time.get_system_time `boost::get_system_time()`]. e.g. boost::system_time const timeout=boost::get_system_time() + boost::posix_time::milliseconds(500); extern bool done; extern boost::mutex m; extern boost::condition_variable cond; boost::unique_lock lk(m); while(!done) { if(!cond.timed_wait(lk,timeout)) { throw "timed out"; } } For the overloads that accept a ['TimeDuration] parameter, an object of any type that meets the [link date_time.posix_time.time_duration Boost.Date_Time Time Duration requirements] can be used, e.g. boost::this_thread::sleep(boost::posix_time::milliseconds(25)); boost::mutex m; if(m.timed_lock(boost::posix_time::nanoseconds(100))) { // ... } [section:system_time Typedef `system_time`] #include typedef boost::posix_time::ptime system_time; See the documentation for [link date_time.posix_time.ptime_class `boost::posix_time::ptime`] in the Boost.Date_Time library. [endsect] [section:get_system_time Non-member function `get_system_time()`] #include system_time get_system_time(); [variablelist [[Returns:] [The current time.]] [[Throws:] [Nothing.]] ] [endsect] [endsect]