updated c++ timer code