This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[c++0x] std::chrono units bug?


Hello. I've implemented a function like this


template <class Units, class Ret, class ... Args>
Units profileFunction(std::function<Ret (Args...)> f, Args ... args)
{
  auto tstart = std::chrono::monotonic_clock::now();
  f(args...);

  return Units(std::chrono::monotonic_clock::now() - tstart);
}


If I use it like this:


cout << profileFunction<std::chrono::microseconds>(myfunc).count() << endl;

It works. If I use seconds or milliseconds, it fails. I can't remember
wether it fails when

doing output or when using it, but it fails. Shouldn't the time units
mind at all?

Thanks in advance.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]