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


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

本文整理汇总了C++中boost::posix_time::time_duration::total_milliseconds方法的典型用法代码示例。如果您正苦于以下问题:C++ time_duration::total_milliseconds方法的具体用法?C++ time_duration::total_milliseconds怎么用?C++ time_duration::total_milliseconds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在boost::posix_time::time_duration的用法示例。


在下文中一共展示了time_duration::total_milliseconds方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: update_local_threshold

void connection::update_local_threshold(boost::posix_time::time_duration duration, std::size_t bytes_sent)
{
	// Move the oob threshold up or down in proportion to the difference between the target latency and
	// how long this operation took
	// We cap any increase at the amount of data sent for this operation. This is to prevent
	// the threshold from overshooting too much on lightly loaded short-thin links.
	local_oob_threshold_ += std::min(double((target_latency.total_milliseconds() - duration.total_milliseconds()))
	                                 / double(target_latency.total_milliseconds()) * local_oob_threshold_,
	                                 double(bytes_sent));
	local_oob_threshold_ = std::max(local_oob_threshold_, 1.0);
}
开发者ID:ssiloti,项目名称:Anynet,代码行数:11,代码来源:connection.cpp

示例2: timingUpdate

// Provide an update on how long the simulation is expected to take to the user
void Simulator::timingUpdate(boost::posix_time::time_duration lastCycleLength) {
    long total = finishTime.minus(startTime, config->getInt("simulationinterval"));
    long complete = currTime.minus(startTime, config->getInt("simulationinterval"));
    long togo = finishTime.minus(currTime, config->getInt("simulationinterval"));
    
    std::cout << "Simulation progress: " << std::endl
              << " - Start  : " << startTime.toString() << std::endl
              << " - Now at : " << currTime.toString() << std::endl
              << " - End    : " << finishTime.toString() << std::endl
              << " - " << std::setprecision(2) << double(complete)/double(total)*100 << "% complete, approximately " 
              << utility::timeDisplay(togo*(long)(lastCycleLength.total_milliseconds())) << " remaining." << std::endl;
}
开发者ID:rikigst,项目名称:POSSIM,代码行数:13,代码来源:Simulator.cpp

示例3: on_hello_response

static void on_hello_response(const std::string& name, fscp::server& server, const fscp::server::ep_type& sender, const boost::posix_time::time_duration& time_duration, bool success)
{
	if (!success)
	{
		std::cout << "[" << name << "] Received no HELLO response from " << sender << " after " << time_duration.total_milliseconds() << " ms" << std::endl;
	} else
	{
		std::cout << "[" << name << "] Received HELLO response from " << sender << " (" << time_duration.total_milliseconds() << " ms)" << std::endl;

		server.async_introduce_to(sender);
	}
}
开发者ID:reaper,项目名称:libfscp,代码行数:12,代码来源:client.cpp

示例4: EPOCH

value_visitor::result_type
value_visitor::operator()(const date_t& value)
{
	static const date_t EPOCH(boost::gregorian::date(1970, 1, 1));
	const boost::posix_time::time_duration duration = value - EPOCH;
	if (duration.seconds() == 0 && duration.fractional_seconds() == 0)
	{
		push_back<std::int8_t>('K');
		push_back<std::int32_t>(duration.total_seconds() / 60);
	}
	else
	{
		push_back<std::int8_t>('J');
		push_back<std::int64_t>(duration.total_milliseconds());
	}
}
开发者ID:octopus-prime,项目名称:hessian_x3,代码行数:16,代码来源:generator_date.hpp

示例5: current_time_string

string current_time_string()  {

  stringstream sstream;
  
  boost::posix_time::ptime now = boost::posix_time::
    microsec_clock::local_time();

    const boost::posix_time::time_duration td = now.time_of_day();
    const long hours        = td.hours();
    const long minutes      = td.minutes();
    const long seconds      = td.seconds();
    const long milliseconds = td.total_milliseconds() -
                              ((hours * 3600 + minutes * 60 + seconds) *
			       1000);
    char buf[40];
    sprintf(buf, "%02ld:%02ld:%02ld.%03ld", 
        hours, minutes, seconds, milliseconds);

    return string(buf);
}
开发者ID:hacoo,项目名称:dougchess-cpp,代码行数:20,代码来源:utility.cpp

示例6: set_connect_timeout

void curl::set_connect_timeout(const boost::posix_time::time_duration& timeout)
{
    set_option(CURLOPT_CONNECTTIMEOUT_MS, timeout.total_milliseconds());
}
开发者ID:reaper,项目名称:libfreelan,代码行数:4,代码来源:curl.cpp

示例7: hash_value

 inline boost::uint64_t hash_value(const boost::posix_time::time_duration& value, boost::uint64_t seed)
 {
     return hash_value((boost::int64_t)value.total_milliseconds(), seed);
 }
开发者ID:llawall,项目名称:protean,代码行数:4,代码来源:hash.hpp


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