move timeval and add debug