X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libtest%2Ftimer.cc;h=ffa8a4b6a3cb89e6cef11ee913697bb756c5d09c;hb=79382f4948d4734711dda45e1ac397bf7149076c;hp=0a8d69b548c71caabb4e52fd6d27d0f77147ebb9;hpb=bce9a74e8addd1085b2e751508bf9ab0c2e84e45;p=m6w6%2Flibmemcached diff --git a/libtest/timer.cc b/libtest/timer.cc index 0a8d69b5..ffa8a4b6 100644 --- a/libtest/timer.cc +++ b/libtest/timer.cc @@ -35,8 +35,11 @@ */ #include + #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; }