本文整理汇总了C++中Timestamp::before方法的典型用法代码示例。如果您正苦于以下问题:C++ Timestamp::before方法的具体用法?C++ Timestamp::before怎么用?C++ Timestamp::before使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Timestamp
的用法示例。
在下文中一共展示了Timestamp::before方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: packets_to_send
CbfPacketBuffer::packet_list CbfPacketBuffer::packets_to_send(Timestamp now)
{
packet_list packets;
// move all packets with expired timeout
for (auto it = m_nodes.begin(); it != m_nodes.end();) {
packet_type& packet = std::get<0>(*it);
CbfPacketMetaData& meta = std::get<1>(*it);
assert(packet.pdu);
if (!now.before(meta.timer_expiry())) {
units::Duration lifetime = packet.pdu->basic().lifetime.decode();
units::Duration queuetime { now - meta.buffered_since() };
m_stored -= length(packet);
if (queuetime < lifetime) {
packet.pdu->basic().lifetime.encode(lifetime - queuetime);
packets.push_back(std::move(packet));
}
it = m_nodes.erase(it);
} else {
++it;
}
}
return packets;
}
示例2: delay_loop
void delay_loop( unsigned long usec ) {
Timestamp end;
end.add( usec * 1e-6 );
Timestamp now;
while ( now.before( end ) ) {
now.setnow();
}
}
示例3: set_timeout
void CbfPacketMetaData::set_timeout(units::Duration timeout, Timestamp now)
{
assert(!now.before(m_buffered_since));
m_timer_expiry = now + Timestamp::duration_type(timeout);
}