fix C++ timing code