From b9bdac02514b305f7fb25d810054c99fa332f4a0 Mon Sep 17 00:00:00 2001 From: oharboe Date: Sat, 23 Feb 2008 08:24:59 +0000 Subject: - added time command - changed syntax of time measurements to seconds, e.g. 1.2324s git-svn-id: svn://svn.berlios.de/openocd/trunk@321 b42882b7-edfa-0310-969c-e2dbd0fdcd60 --- src/helper/time_support.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/helper/time_support.c') diff --git a/src/helper/time_support.c b/src/helper/time_support.c index de48fce8..f772d2f4 100644 --- a/src/helper/time_support.c +++ b/src/helper/time_support.c @@ -102,8 +102,11 @@ int duration_stop_measure(duration_t *duration, char **text) if (text) { - *text = malloc(16); - snprintf(*text, 16, "%lis %lius", duration->duration.tv_sec, duration->duration.tv_usec); + float t; + t=duration->duration.tv_sec; + t+=(float)duration->duration.tv_usec/1000000.0; + *text = malloc(100); + snprintf(*text, 100, "%fs", t); } return ERROR_OK; -- cgit v1.2.3