本文整理汇总了C++中Duration::format方法的典型用法代码示例。如果您正苦于以下问题:C++ Duration::format方法的具体用法?C++ Duration::format怎么用?C++ Duration::format使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Duration
的用法示例。
在下文中一共展示了Duration::format方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: calculateRates
//.........这里部分代码省略.........
break;
}
int total_added_50 = 0;
int total_added_75 = 0;
int total_removed_50 = 0;
int total_removed_75 = 0;
for (unsigned int i = half; i < sequence.size (); ++i)
{
total_added_50 += bars[sequence[i]].added;
total_removed_50 += bars[sequence[i]].removed;
}
for (unsigned int i = half + quarter; i < sequence.size (); ++i)
{
total_added_75 += bars[sequence[i]].added;
total_removed_75 += bars[sequence[i]].removed;
}
float find_rate_50 = 1.0 * total_added_50 / half_days;
float find_rate_75 = 1.0 * total_added_75 / quarter_days;
float fix_rate_50 = 1.0 * total_removed_50 / half_days;
float fix_rate_75 = 1.0 * total_removed_75 / quarter_days;
// Make configurable.
float bias = (float) context.config.getReal ("burndown.bias");
find_rate = (find_rate_50 * (1.0 - bias) + find_rate_75 * bias);
fix_rate = (fix_rate_50 * (1.0 - bias) + fix_rate_75 * bias);
// Q: Why is this equation written out as a debug message?
// A: People are going to want to know how the rates and the completion date
// are calculated. This may also help debugging.
std::stringstream rates;
rates << "Chart::calculateRates find rate: "
<< "("
<< total_added_50
<< " added / "
<< half_days
<< " days) * (1.0 - "
<< bias
<< ") + ("
<< total_added_75
<< " added / "
<< quarter_days
<< " days) * "
<< bias
<< ") = "
<< find_rate
<< "\nChart::calculateRates fix rate: "
<< "("
<< total_removed_50
<< " removed / "
<< half_days
<< " days) * (1.0 - "
<< bias
<< ") + ("
<< total_removed_75
<< " added / "
<< quarter_days
<< " days) * "
<< bias
<< ") = "
<< fix_rate;
context.debug (rates.str ());
// Estimate completion
if (fix_rate > find_rate)
{
int current_pending = bars[sequence.back ()].pending;
int remaining_days = (int) (current_pending / (fix_rate - find_rate));
Date now;
Duration delta (remaining_days * 86400);
now += delta;
completion = now.toString (context.config.get ("dateformat"))
+ " ("
+ delta.format ()
+ ")";
std::stringstream est;
est << "Chart::calculateRates Completion: "
<< current_pending
<< " tasks / ("
<< fix_rate
<< " - "
<< find_rate
<< ") = "
<< remaining_days
<< " days = "
<< completion;
context.debug (est.str ());
}
else
{
completion = STRING_CMD_BURN_NO_CONVERGE;
}
}