本文整理汇总了C++中Duration::toSeconds方法的典型用法代码示例。如果您正苦于以下问题:C++ Duration::toSeconds方法的具体用法?C++ Duration::toSeconds怎么用?C++ Duration::toSeconds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Duration
的用法示例。
在下文中一共展示了Duration::toSeconds方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get
double get(const Time& t, double K) const {
Duration diff = t - _t;
double dt = diff.toSeconds();
if (dt<1.0e-9) {
return _value;
}
double blend = exp(-dt/K);
uint32 new_bytes = _backlog;
return _value*blend+(1-blend)*new_bytes/dt;
}
示例2: estimate_rate
double estimate_rate(const Time& t, uint32 len, double K) {
Duration diff = t - _t;
double dt = diff.toSeconds();
if (dt<1.0e-9) {
_backlog += len;
return _value;
}
double blend = exp(-dt/K);
uint32 new_bytes = len + _backlog;
_value=_value*blend+(1-blend)*new_bytes/dt;
_t = t;
_backlog = 0;
return _value;
}
示例3: start
void TimerSpeedBenchmark::start() {
mForceStop = false;
// Check throughput of timer calls
Time start_time = Timer::now();
Time dummy_t = Time::null();
for(uint32 ii = 0; ii < ITERATIONS && !mForceStop; ii++)
dummy_t = Timer::now();
if (mForceStop)
return;
Time end_time = Timer::now();
Duration dur = end_time - start_time;
SILOG(benchmark,info,
ITERATIONS << " timer invokations, " << dur << ": "
<< (dur.toMicroseconds()*1000/float(ITERATIONS)) << "ns/call, "
<< float(ITERATIONS)/dur.toSeconds() << " calls/s");
notifyFinished();
}
示例4: position
PositionType position(const Duration& dt) const {
return Base::value().position() + Base::value().velocity() * dt.toSeconds();
}
示例5: extrapolate
MotionVector extrapolate(const Duration& dt) const {
return MotionVector(mStart + mDirection * dt.toSeconds(), mDirection);
}