diff options
author | Ralf Corsepius <ralf.corsepius@rtems.org> | 2011-10-02 10:37:28 +0000 |
---|---|---|
committer | Ralf Corsepius <ralf.corsepius@rtems.org> | 2011-10-02 10:37:28 +0000 |
commit | f922d1d8735eaec4295caaf08c8cf4e6367033b7 (patch) | |
tree | 8046a5d7746d8d187192fd140569bf8c7c2b2ed4 /cpukit | |
parent | 2011-10-02 Ralf Corsépius <ralf.corsepius@rtems.org> (diff) | |
download | rtems-f922d1d8735eaec4295caaf08c8cf4e6367033b7.tar.bz2 |
2011-10-02 Ralf Corsépius <ralf.corsepius@rtems.org>
* libmisc/uuid/gen_uuid.c: Introduce PRIutime_t, SCNutime_t and
"utime_t" for 64bit-time_t support.
Diffstat (limited to 'cpukit')
-rw-r--r-- | cpukit/ChangeLog | 2 | ||||
-rw-r--r-- | cpukit/libmisc/uuid/gen_uuid.c | 19 |
2 files changed, 17 insertions, 4 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index 2844768e5b..97c1e2fec7 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,6 +1,6 @@ 2011-10-02 Ralf Corsépius <ralf.corsepius@rtems.org> - * libmisc/shell/main_time.c: Introduce PRIutime_t, SCNutime_t and + * libmisc/uuid/gen_uuid.c: Introduce PRIutime_t, SCNutime_t and "utime_t" for 64bit-time_t support. 2011-10-02 Ralf Corsépius <ralf.corsepius@rtems.org> diff --git a/cpukit/libmisc/uuid/gen_uuid.c b/cpukit/libmisc/uuid/gen_uuid.c index 7993ee5332..059963764e 100644 --- a/cpukit/libmisc/uuid/gen_uuid.c +++ b/cpukit/libmisc/uuid/gen_uuid.c @@ -95,6 +95,18 @@ #include <sys/resource.h> #endif +#if SIZEOF_TIME_T == 8 +#define PRIutime_t PRIu64 +#define SCNutime_t SCNu64 +#define utime_t uint64_t +#elif SIZEOF_TIME_T == 4 +#define PRIutime_t PRIu32 +#define SCNutime_t SCNu32 +#define utime_t uint32_t +#else +#error "unsupport size of time_t" +#endif + #include "uuidP.h" #include "uuidd.h" @@ -352,10 +364,11 @@ static int get_clock(uint32_t *clock_high, uint32_t *clock_low, } if (state_fd >= 0) { unsigned int cl; - unsigned long tv1, tv2; + utime_t tv1; + unsigned long tv2; int a; - if (fscanf(state_f, "clock: %04x tv: %lu %lu adj: %d\n", + if (fscanf(state_f, "clock: %04x tv: %" SCNutime_t " %lu adj: %d\n", &cl, &tv1, &tv2, &a) == 4) { clock_seq = cl & 0x3FFF; last.tv_sec = tv1; @@ -404,7 +417,7 @@ try_again: if (state_fd > 0) { rewind(state_f); len = fprintf(state_f, - "clock: %04x tv: %016lu %08lu adj: %08d\n", + "clock: %04x tv: %016" PRIutime_t " %08lu adj: %08d\n", clock_seq, last.tv_sec, last.tv_usec, adjustment); fflush(state_f); if (ftruncate(state_fd, len) < 0) { |