X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;ds=sidebyside;f=libtest%2Ftimer.cc;h=fe164ecfcaa21afef901d7cb52b432160735786e;hb=0f8935c1217d98bb2d7054eeea797cfc73a5bd17;hp=0a8d69b548c71caabb4e52fd6d27d0f77147ebb9;hpb=1be0350e7ae7a566896a9fe52863dcc22433fc8a;p=awesomized%2Flibmemcached diff --git a/libtest/timer.cc b/libtest/timer.cc index 0a8d69b5..fe164ecf 100644 --- a/libtest/timer.cc +++ b/libtest/timer.cc @@ -34,9 +34,12 @@ * */ -#include +#include "libtest/yatlcon.h" + #include + #include +#include namespace libtest { @@ -45,9 +48,18 @@ std::ostream& operator<<(std::ostream& output, const libtest::Timer& arg) struct timespec temp; arg.difference(temp); - output << temp.tv_sec; + if (temp.tv_sec > 60) + { + output << temp.tv_sec / 60; + output << "." << temp.tv_sec % 60; + } + else + { + output << temp.tv_sec; + } + output << ":"; - output << temp.tv_nsec; + output << std::setfill('0') << std::setw(9) << temp.tv_nsec; return output; }