コード例 #1
0
ファイル: main.cpp プロジェクト: Zhang-Yi/tornet
void print_record( const tornet::db::peer::record& rec, const tornet::node::ptr& nd ) {
  std::cerr<< std::setw(21) 
           << (boost::asio::ip::address_v4(rec.last_ip).to_string()+":"+boost::lexical_cast<std::string>(rec.last_port))<<" "
           << rec.id() << " "
           << std::setw(10)  << calc_dist(rec.id() ^ nd->get_id()) << " "
           << std::setw(5)   << int(rec.rank) << " "
           << std::setw(5)   << int(rec.published_rank) << " "
           << std::setw(8)   << double(rec.availability) / uint16_t(0xffff) <<" "
           << std::setw(8)   << (rec.avg_rtt_us) <<" "
           << std::setw(10)  << rec.est_bandwidth << " "
           << std::setw(10)  << rec.sent_credit << " "
           << std::setw(10)  << rec.recv_credit << " "
           << std::setw(3)   << (rec.firewalled ? 'Y' : 'N') << " "
           << std::setw(30)  << boost::posix_time::to_simple_string(to_system_time( rec.first_contact )) <<" "
           << std::setw(30)  << boost::posix_time::to_simple_string(to_system_time( rec.last_contact ))  <<" "
           << std::setw(10)  << (rec.nonce[0]) << " " << std::setw(10) << (rec.nonce[1]) << " "
           << std::endl;
}
コード例 #2
0
ファイル: chrono.cpp プロジェクト: noxiouz/handystats
time_point time_point::convert_to(const clock_type& to_clock, const time_point& t) {
	if (t.m_clock == to_clock) return t;

	if (to_clock == clock_type::SYSTEM) {
		return to_system_time(t);
	}
	else {
		// to_clock == clock_type::TSC
		throw std::logic_error("SYSTEM to TSC clock conversion is not implemented");
	}
}
コード例 #3
0
ファイル: logmessage.cpp プロジェクト: amarburg/g3log
 std::string LogMessage::timestamp(const std::string& time_look) const {
    return g3::localtime_formatted(to_system_time(_timestamp), time_look);
 }