forked from premiere/premiere-libtorrent
fixed time formatting in client_test
This commit is contained in:
parent
373263677c
commit
b05abc76f4
|
@ -161,6 +161,16 @@ std::string esc(char const* code)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string to_string(int v, int width)
|
||||||
|
{
|
||||||
|
std::stringstream s;
|
||||||
|
s.flags(std::ios_base::right);
|
||||||
|
s.width(width);
|
||||||
|
s.fill('0');
|
||||||
|
s << v;
|
||||||
|
return s.str();
|
||||||
|
}
|
||||||
|
|
||||||
std::string to_string(float v, int width, int precision = 3)
|
std::string to_string(float v, int width, int precision = 3)
|
||||||
{
|
{
|
||||||
std::stringstream s;
|
std::stringstream s;
|
||||||
|
@ -919,10 +929,10 @@ int main(int ac, char* av[])
|
||||||
if (s.state != torrent_status::seeding)
|
if (s.state != torrent_status::seeding)
|
||||||
{
|
{
|
||||||
boost::posix_time::time_duration t = s.next_announce;
|
boost::posix_time::time_duration t = s.next_announce;
|
||||||
out << " next announce: " << esc("37") << std::setfill('0')
|
out << " next announce: " << esc("37")
|
||||||
<< std::setw(2) << t.hours() << ":"
|
<< to_string(t.hours(),2) << ":"
|
||||||
<< std::setw(2) << t.minutes() << ":"
|
<< to_string(t.minutes(),2) << ":"
|
||||||
<< std::setw(2) << t.seconds() << esc("0") << " " << std::setfill(' ');
|
<< to_string(t.seconds(), 2) << esc("0") << " ";
|
||||||
out << "tracker: " << s.current_tracker << "\n";
|
out << "tracker: " << s.current_tracker << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue