当前位置: 首页>>代码示例>>C++>>正文


C++ time_duration::is_not_a_date_time方法代码示例

本文整理汇总了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&>()
				);
			}
		}
开发者ID:Tisseo,项目名称:synthese,代码行数:33,代码来源:SchedulesBasedService.cpp

示例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;
}
开发者ID:october19191,项目名称:FREEDM,代码行数:51,代码来源:CBroker.cpp

示例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 ();
		}
开发者ID:Tisseo,项目名称:synthese,代码行数:19,代码来源:SchedulesBasedService.cpp

示例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;
}
开发者ID:rstudio,项目名称:rstudio,代码行数:23,代码来源:Process.cpp


注:本文中的boost::posix_time::time_duration::is_not_a_date_time方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。