Commit 9d9fc227 authored by Federico Vaga's avatar Federico Vaga

tools: fix print warnings

Signed-off-by: 's avatarFederico Vaga <federico.vaga@gmail.com>
parent d36603aa
......@@ -11,19 +11,20 @@
* fmctdc-read: read timestamps from a given FmcTdc card.
*/
#include <inttypes.h>
#include "test-common.h"
void dump_timestamp(struct fmctdc_time ts, int channel, int fmt_wr)
{
if (fmt_wr)
printf("channel %d seq %-12u ts %10llu:%09u:%04u\n", channel,
printf("channel %d seq %-12u ts %10"PRIu64":%09u:%04u\n", channel,
ts.seq_id, ts.seconds, ts.coarse, ts.frac);
else {
uint64_t picoseconds =
(uint64_t) ts.coarse * 8000ULL +
(uint64_t) ts.frac * 8000ULL / 4096ULL;
printf
("channel %d seq %-12u ts %10llu.%03llu,%03llu,%03llu,%03llu ps\n",
("channel %d seq %-12u ts %10"PRIu64".%03llu,%03llu,%03llu,%03llu ps\n",
channel, ts.seq_id, ts.seconds,
picoseconds / 1000000000ULL,
(picoseconds / 1000000ULL) % 1000ULL,
......
......@@ -20,6 +20,7 @@
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
#include <inttypes.h>
#include <getopt.h>
......@@ -35,14 +36,14 @@ void dump_timestamp(struct fmctdc_time ts, int fmt_wr)
if (fmt_wr) {
/* White rabbit format */
fprintf(stdout, "%10llu:%09u:%04u",
fprintf(stdout, "%10"PRIu64":%09u:%04u",
ts.seconds, ts.coarse, ts.frac);
return;
} else {
picoseconds = (uint64_t) ts.coarse * 8000ULL +
(uint64_t) ts.frac * 8000ULL / 4096ULL;
fprintf(stdout,
"%010llu.%03llu,%03llu,%03llu,%03llu ps",
"%010"PRIu64".%03llu,%03llu,%03llu,%03llu ps",
ts.seconds,
picoseconds / 1000000000ULL,
(picoseconds / 1000000ULL) % 1000ULL,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment