diff options
author | Ralf Corsepius <ralf.corsepius@rtems.org> | 2011-10-02 08:15:02 +0000 |
---|---|---|
committer | Ralf Corsepius <ralf.corsepius@rtems.org> | 2011-10-02 08:15:02 +0000 |
commit | 94107fa84afeaa7eedd9698e50e6ebd1372338d6 (patch) | |
tree | 52c567c625c2c76c5f94669e1c9bcebe5a77388d /cpukit/libmisc/shell | |
parent | 2011-10-02 Ralf Corsépius <ralf.corsepius@rtems.org> (diff) | |
download | rtems-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/libmisc/shell')
-rw-r--r-- | cpukit/libmisc/shell/main_time.c | 12 |
1 files changed, 11 insertions, 1 deletions
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); |