This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
[c++0x] std::chrono units bug?
- From: Germán Diago <germandiago at gmail dot com>
- To: libstdc++ at gcc dot gnu dot org
- Date: Tue, 19 Jan 2010 13:22:35 +0100
- Subject: [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.