Skip to content

Commit

Permalink
tests/xtimer_drift: Clean up data types in printf loop
Browse files Browse the repository at this point in the history
  • Loading branch information
Joakim Nohlgård committed Mar 17, 2016
1 parent f03194f commit ed0cb74
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions tests/xtimer_drift/main.c
Expand Up @@ -87,7 +87,7 @@ void *slacker_thread(void *arg)
void *worker_thread(void *arg)
{
(void) arg;
unsigned int loop_counter = 0;
uint32_t loop_counter = 0;
uint32_t start = 0;
uint32_t last = 0;

Expand All @@ -105,18 +105,19 @@ void *worker_thread(void *arg)
}

uint32_t us, sec;
unsigned int min, hr;
us = now % 1000000;
sec = now / 1000000;
uint32_t min, hr;
us = now % SEC_IN_USEC;
sec = now / SEC_IN_USEC;
min = (sec / 60) % 60;
hr = sec / 3600;
if ((loop_counter % TEST_HZ) == 0) {
uint32_t expected = start + loop_counter * TEST_INTERVAL;
int32_t drift = now - expected;
expected = last + TEST_HZ * TEST_INTERVAL;
int32_t jitter = now - expected;
printf("now=%" PRIu32 ".%06" PRIu32 " (%u hours %u min), drift=%" PRId32 " us, jitter=%" PRId32 " us\n",
sec, us, hr, min, drift, jitter);
printf("now=%" PRIu32 ".%06" PRIu32 " (%" PRIu32 " hours %" PRIu32 " min), ",
sec, us, hr, min);
printf("drift=%" PRId32 " us, jitter=%" PRId32 " us\n", drift, jitter);
last = now;
}
++loop_counter;
Expand Down

0 comments on commit ed0cb74

Please sign in to comment.