along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "server.h"
-#include "gdb_sys_time.h"
+#include <chrono>
/* Enable miscellaneous debugging output. The name is historical - it
was originally used to debug LinuxThreads support. */
int debug_timestamp;
/* Print a debugging message.
- If the text begins a new line it is preceded by a timestamp, if the
- system has gettimeofday.
+ If the text begins a new line it is preceded by a timestamp.
We don't get fancy with newline checking, we just check whether the
previous call ended with "\n". */
if (debug_timestamp && new_line)
{
- struct timeval tm;
+ using namespace std::chrono;
- gettimeofday (&tm, NULL);
+ steady_clock::time_point now = steady_clock::now ();
+ seconds s = duration_cast<seconds> (now.time_since_epoch ());
+ microseconds us = duration_cast<microseconds> (now.time_since_epoch ()) - s;
- /* If gettimeofday doesn't exist, and as a portability solution it has
- been replaced with, e.g., time, then it doesn't make sense to print
- the microseconds field. Is there a way to check for that? */
- fprintf (stderr, "%ld:%06ld ", (long) tm.tv_sec, (long) tm.tv_usec);
+ fprintf (stderr, "%ld.%06ld ", (long) s.count (), (long) us.count ());
}
#endif