/* Test program for process and thread CPU clocks.
- Copyright (C) 2005, 2012 Free Software Foundation, Inc.
+ Copyright (C) 2005-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
<http://www.gnu.org/licenses/>. */
#include <unistd.h>
+#include <stdint.h>
#if (_POSIX_THREADS - 0) <= 0
result = 1;
return 1;
}
- printf ("live thread clock %lx resolution %lu.%.9lu\n",
- (unsigned long int) th_clock, res.tv_sec, res.tv_nsec);
+ printf ("live thread clock %lx resolution %ju.%.9ju\n",
+ (unsigned long int) th_clock,
+ (uintmax_t) res.tv_sec, (uintmax_t) res.tv_nsec);
struct timespec process_before, process_after;
if (clock_gettime (process_clock, &process_before) < 0)
(unsigned long int) th_clock, strerror (errno));
return 1;
}
- printf ("live thread before sleep => %lu.%.9lu\n",
- before.tv_sec, before.tv_nsec);
+ printf ("live thread before sleep => %ju.%.9ju\n",
+ (uintmax_t) before.tv_sec, (uintmax_t) before.tv_nsec);
struct timespec me_before, me_after;
if (clock_gettime (my_thread_clock, &me_before) < 0)
(unsigned long int) my_thread_clock, strerror (errno));
return 1;
}
- printf ("self thread before sleep => %lu.%.9lu\n",
- me_before.tv_sec, me_before.tv_nsec);
+ printf ("self thread before sleep => %ju.%.9ju\n",
+ (uintmax_t) me_before.tv_sec, (uintmax_t) me_before.tv_nsec);
struct timespec sleeptime = { .tv_nsec = 500000000 };
if (nanosleep (&sleeptime, NULL) != 0)
(unsigned long int) th_clock, strerror (errno));
return 1;
}
- printf ("live thread after sleep => %lu.%.9lu\n",
- after.tv_sec, after.tv_nsec);
+ printf ("live thread after sleep => %ju.%.9ju\n",
+ (uintmax_t) after.tv_sec, (uintmax_t) after.tv_nsec);
if (clock_gettime (process_clock, &process_after) < 0)
{
(unsigned long int) my_thread_clock, strerror (errno));
return 1;
}
- printf ("self thread after sleep => %lu.%.9lu\n",
- me_after.tv_sec, me_after.tv_nsec);
+ printf ("self thread after sleep => %ju.%.9ju\n",
+ (uintmax_t) me_after.tv_sec, (uintmax_t) me_after.tv_nsec);
unsigned long long int th_diff = tsdiff (&before, &after);
unsigned long long int pdiff = tsdiff (&process_before, &process_after);