本文整理汇总了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);
}
示例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;
}
示例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);
}
}
示例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());
}
}
示例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);
}
示例6: set_connect_timeout
void curl::set_connect_timeout(const boost::posix_time::time_duration& timeout)
{
set_option(CURLOPT_CONNECTTIMEOUT_MS, timeout.total_milliseconds());
}
示例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);
}