本文整理汇总了C++中time_duration::seconds方法的典型用法代码示例。如果您正苦于以下问题:C++ time_duration::seconds方法的具体用法?C++ time_duration::seconds怎么用?C++ time_duration::seconds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类time_duration
的用法示例。
在下文中一共展示了time_duration::seconds方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wait_and_retry_start
void node_impl::wait_and_retry_start(const std::error_code& ec)
{
BITCOIN_ASSERT(ec);
log_error() << "Unable to start session: " << ec.message();
log_error() << "Retrying in "
<< retry_start_duration.seconds() << " seconds.";
retry_start_timer_.expires_from_now(retry_start_duration);
retry_start_timer_.async_wait(
std::bind(&node_impl::start_session, this));
}
示例2: switch
inline std::basic_string<charT> to_simple_string_type(time_duration td) {
std::basic_ostringstream<charT> ss;
if(td.is_special()) {
/* simply using 'ss << td.get_rep()' won't work on compilers
* that don't support locales. This way does. */
// switch copied from date_names_put.hpp
switch(td.get_rep().as_special())
{
case not_a_date_time:
//ss << "not-a-number";
ss << "not-a-date-time";
break;
case pos_infin:
ss << "+infinity";
break;
case neg_infin:
ss << "-infinity";
break;
default:
ss << "";
}
}
else {
charT fill_char = '0';
if(td.is_negative()) {
ss << '-';
}
ss << std::setw(2) << std::setfill(fill_char)
<< date_time::absolute_value(td.hours()) << ":";
ss << std::setw(2) << std::setfill(fill_char)
<< date_time::absolute_value(td.minutes()) << ":";
ss << std::setw(2) << std::setfill(fill_char)
<< date_time::absolute_value(td.seconds());
//TODO the following is totally non-generic, yelling FIXME
#if (defined(BOOST_MSVC) && (_MSC_VER <= 1200)) // 1200 == VC++ 6.0
boost::int64_t frac_sec =
date_time::absolute_value(td.fractional_seconds());
// JDG [7/6/02 VC++ compatibility]
charT buff[32];
_i64toa(frac_sec, buff, 10);
#else
time_duration::fractional_seconds_type frac_sec =
date_time::absolute_value(td.fractional_seconds());
#endif
if (frac_sec != 0) {
ss << "." << std::setw(time_duration::num_fractional_digits())
<< std::setfill(fill_char)
// JDG [7/6/02 VC++ compatibility]
#if (defined(BOOST_MSVC) && (_MSC_VER <= 1200)) // 1200 == VC++ 6.0
<< buff;
#else
<< frac_sec;
#endif
}
示例3: switch
/*!\ingroup time_format
*/
inline
std::string
to_iso_string(time_duration td)
{
std::ostringstream ss;
if(td.is_special()) {
/* simply using 'ss << td.get_rep()' won't work on compilers
* that don't support locales. This way does. */
// switch copied from date_names_put.hpp
switch(td.get_rep().as_special()) {
case not_a_date_time:
//ss << "not-a-number";
ss << "not-a-date-time";
break;
case pos_infin:
ss << "+infinity";
break;
case neg_infin:
ss << "-infinity";
break;
default:
ss << "";
}
}
else {
if(td.is_negative()) {
ss << '-';
}
ss << std::setw(2) << std::setfill('0')
<< date_time::absolute_value(td.hours());
ss << std::setw(2) << std::setfill('0')
<< date_time::absolute_value(td.minutes());
ss << std::setw(2) << std::setfill('0')
<< date_time::absolute_value(td.seconds());
//TODO the following is totally non-generic, yelling FIXME
time_duration::fractional_seconds_type frac_sec =
date_time::absolute_value(td.fractional_seconds());
if (frac_sec != 0) {
ss << "." << std::setw(time_duration::num_fractional_digits())
<< std::setfill('0')
<< frac_sec;
}
}// else
return ss.str();
}
示例4: toStringSec
string TimerStructs::toStringSec(time_duration & duration) {
return padded2DString(duration.seconds());
}