本文整理汇总了C++中boost::posix_time::time_duration::is_not_a_date_time方法的典型用法代码示例。如果您正苦于以下问题:C++ time_duration::is_not_a_date_time方法的具体用法?C++ time_duration::is_not_a_date_time怎么用?C++ time_duration::is_not_a_date_time使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boost::posix_time::time_duration
的用法示例。
在下文中一共展示了time_duration::is_not_a_date_time方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setRealTimeSchedules
void SchedulesBasedService::setRealTimeSchedules(
size_t rank,
boost::posix_time::time_duration departureSchedule,
boost::posix_time::time_duration arrivalSchedule
){
recursive_mutex::scoped_lock lock(_generatedSchedulesMutex);
_initRTSchedulesFromPlanned();
if(!departureSchedule.is_not_a_date_time())
{
_RTDepartureSchedules[rank] = departureSchedule;
}
if(!arrivalSchedule.is_not_a_date_time())
{
_RTArrivalSchedules[rank] = arrivalSchedule;
if(rank + 1 == _RTArrivalSchedules.size())
{
_computeNextRTUpdate();
}
}
_path->markScheduleIndexesUpdateNeeded(true);
// Inter-SYNTHESE sync
if(Factory<InterSYNTHESESyncTypeFactory>::size()) // Avoid in unit tests
{
RealTimePTDataInterSYNTHESE::Content content(*this);
inter_synthese::InterSYNTHESEModule::Enqueue(
content,
boost::optional<db::DBTransaction&>()
);
}
}
示例2: Schedule
///////////////////////////////////////////////////////////////////////////////
/// @fn CBroker::Schedule
/// @description Given a scheduleable task that should be run in the
/// future. The task will be scheduled to run by the Broker after the timer
/// expires and during the module that owns the timer's phase. The attempt to
/// schedule may be rejected if the Broker is stopping, indicated by the return
/// value.
/// @param h The handle to the timer being set.
/// @param wait the amount of the time to wait. If this value is "not_a_date_time"
/// The wait is converted to positive infinity and the time will expire as
/// soon as it is not the module that owns the timer's phase.
/// @param x A schedulable, a functor, that expects a single
/// boost::system::error_code parameter and returns void, created via
/// boost::bind()
/// @pre The module is registered
/// @post If the Broker is not stopping, the function is scheduled to be called
/// in the future. If a next time function is scheduled, its timer will
/// expire as soon as its round ends. If the Broker is stopping the task
/// will not be scheduled.
/// @return 0 on success, -1 if rejected
///////////////////////////////////////////////////////////////////////////////
int CBroker::Schedule(CBroker::TimerHandle h,
boost::posix_time::time_duration wait, CBroker::Scheduleable x)
{
Logger.Trace << __PRETTY_FUNCTION__ << std::endl;
{
boost::unique_lock<boost::mutex> lock(m_stoppingMutex);
if (m_stopping)
{
return -1;
}
}
boost::mutex::scoped_lock schlock(m_schmutex);
CBroker::Scheduleable s;
if(wait.is_not_a_date_time())
{
wait = boost::posix_time::time_duration(boost::posix_time::pos_infin);
m_nexttime[h] = true;
}
else
{
m_nexttime[h] = false;
}
m_timers[h]->expires_from_now(wait);
s = boost::bind(&CBroker::ScheduledTask,this,x,h,boost::asio::placeholders::error);
Logger.Debug<<"Scheduled task for timer "<<h<<std::endl;
m_timers[h]->async_wait(s);
return 0;
}
示例3: EncodeSchedule
std::string SchedulesBasedService::EncodeSchedule( const boost::posix_time::time_duration& value )
{
if(value.is_not_a_date_time())
{
return string();
}
std::stringstream os;
os << std::setw( 2 ) << std::setfill ( '0' )
<< (value.hours() / 24) << ":"
<< std::setw( 2 ) << std::setfill ( '0' )
<< (value.hours() % 24) << ":"
<< std::setw( 2 ) << std::setfill ( '0' )
<< value.minutes()
;
return os.str ();
}
示例4: wait
bool ProcessSupervisor::wait(
const boost::posix_time::time_duration& pollingInterval,
const boost::posix_time::time_duration& maxWait)
{
boost::posix_time::ptime timeoutTime(boost::posix_time::not_a_date_time);
if (!maxWait.is_not_a_date_time())
timeoutTime = boost::get_system_time() + maxWait;
while (poll())
{
// wait the specified polling interval
boost::this_thread::sleep(pollingInterval);
// check for timeout if appropriate
if (!timeoutTime.is_not_a_date_time())
{
if (boost::get_system_time() > timeoutTime)
return false;
}
}
return true;
}