summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorRalf Corsepius <ralf.corsepius@rtems.org>2011-10-02 08:15:02 +0000
committerRalf Corsepius <ralf.corsepius@rtems.org>2011-10-02 08:15:02 +0000
commit94107fa84afeaa7eedd9698e50e6ebd1372338d6 (patch)
tree52c567c625c2c76c5f94669e1c9bcebe5a77388d /cpukit
parent2011-10-02 Ralf Corsépius <ralf.corsepius@rtems.org> (diff)
downloadrtems-94107fa84afeaa7eedd9698e50e6ebd1372338d6.tar.bz2
2011-10-02 Ralf Corsépius <ralf.corsepius@rtems.org>
* libmisc/shell/main_time.c: Introduce PRIdtime_t.
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/ChangeLog4
-rw-r--r--cpukit/libmisc/shell/main_time.c12
2 files changed, 15 insertions, 1 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog
index 4eb00641ae..61df590689 100644
--- a/cpukit/ChangeLog
+++ b/cpukit/ChangeLog
@@ -1,5 +1,9 @@
2011-10-02 Ralf Corsépius <ralf.corsepius@rtems.org>
+ * libmisc/shell/main_time.c: Introduce PRIdtime_t.
+
+2011-10-02 Ralf Corsépius <ralf.corsepius@rtems.org>
+
* libnetworking/libc/res_comp.c: Eliminate unused var "ppch".
2011-09-30 Ralf Corsépius <ralf.corsepius@rtems.org>
diff --git a/cpukit/libmisc/shell/main_time.c b/cpukit/libmisc/shell/main_time.c
index 7d6cf557ee..fac90ae855 100644
--- a/cpukit/libmisc/shell/main_time.c
+++ b/cpukit/libmisc/shell/main_time.c
@@ -17,6 +17,7 @@
#include <stdio.h>
#include <unistd.h>
#include <string.h>
+#include <inttypes.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -25,6 +26,15 @@
#include <rtems/shell.h>
#include "internal.h"
+/* Helper macro to print "time_t" */
+#if SIZEOF_TIME_T == 8
+#define PRIdtime_t PRId64
+#elif SIZEOF_TIME_T == 4
+#define PRIdtime_t PRId32
+#else
+#error "PRIdtime_t: unsupported size of time_t"
+#endif
+
int rtems_shell_main_time(
int argc,
char *argv[]
@@ -66,7 +76,7 @@ int rtems_shell_main_time(
period.tv_nsec += 1000000000UL;
}
- printf("time: %li:%02li:%02li.%03li\n",
+ printf("time: %" PRIdtime_t ":%02" PRIdtime_t ":%02" PRIdtime_t ".%03li\n",
period.tv_sec / 3600,
period.tv_sec / 60, period.tv_sec % 60,
period.tv_nsec / 1000000);