From 94107fa84afeaa7eedd9698e50e6ebd1372338d6 Mon Sep 17 00:00:00 2001 From: Ralf Corsepius Date: Sun, 2 Oct 2011 08:15:02 +0000 Subject: [PATCH] =?UTF-8?q?2011-10-02=09Ralf=20Cors=C3=A9pius=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * libmisc/shell/main_time.c: Introduce PRIdtime_t. --- cpukit/ChangeLog | 4 ++++ cpukit/libmisc/shell/main_time.c | 12 +++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index 4eb00641ae..61df590689 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,3 +1,7 @@ +2011-10-02 Ralf Corsépius + + * libmisc/shell/main_time.c: Introduce PRIdtime_t. + 2011-10-02 Ralf Corsépius * libnetworking/libc/res_comp.c: Eliminate unused var "ppch". 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 #include #include +#include #include #include #include @@ -25,6 +26,15 @@ #include #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);