Fix -Wformat warnings.

master
Miroslav Lichvar 2012-12-18 14:00:49 +01:00 committed by Richard Cochran
parent b5ec128574
commit 84c7ac6b52
2 changed files with 7 additions and 5 deletions

View File

@ -28,6 +28,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include <inttypes.h>
#include <linux/pps.h> #include <linux/pps.h>
#include <linux/ptp_clock.h> #include <linux/ptp_clock.h>
@ -141,7 +142,7 @@ static struct servo servo;
static void show_servo(FILE *fp, const char *label, int64_t offset, uint64_t ts) static void show_servo(FILE *fp, const char *label, int64_t offset, uint64_t ts)
{ {
fprintf(fp, "%s %9lld s%d %lld.%09llu drift %.2f\n", label, offset, fprintf(fp, "%s %9" PRId64 " s%d %lld.%09llu drift %.2f\n", label, offset,
servo.state, ts / NS_PER_SEC, ts % NS_PER_SEC, servo.drift); servo.state, ts / NS_PER_SEC, ts % NS_PER_SEC, servo.drift);
fflush(fp); fflush(fp);
} }

9
pmc.c
View File

@ -23,6 +23,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <inttypes.h>
#include "ds.h" #include "ds.h"
#include "fsm.h" #include "fsm.h"
@ -282,12 +283,12 @@ static void pmc_show(struct ptp_message *msg, FILE *fp)
case TIME_STATUS_NP: case TIME_STATUS_NP:
tsn = (struct time_status_np *) mgt->data; tsn = (struct time_status_np *) mgt->data;
fprintf(fp, "TIME_STATUS_NP " fprintf(fp, "TIME_STATUS_NP "
IFMT "master_offset %lld" IFMT "master_offset %" PRId64
IFMT "ingress_time %lld" IFMT "ingress_time %" PRId64
IFMT "cumulativeScaledRateOffset %+.9f" IFMT "cumulativeScaledRateOffset %+.9f"
IFMT "scaledLastGmPhaseChange %d" IFMT "scaledLastGmPhaseChange %d"
IFMT "gmTimeBaseIndicator %hu" IFMT "gmTimeBaseIndicator %hu"
IFMT "lastGmPhaseChange 0x%04hx'%016llx.%04hx" IFMT "lastGmPhaseChange 0x%04hx'%016" PRIx64 ".%04hx"
IFMT "gmPresent %s" IFMT "gmPresent %s"
IFMT "gmIdentity %s", IFMT "gmIdentity %s",
tsn->master_offset, tsn->master_offset,
@ -310,7 +311,7 @@ static void pmc_show(struct ptp_message *msg, FILE *fp)
IFMT "portIdentity %s" IFMT "portIdentity %s"
IFMT "portState %s" IFMT "portState %s"
IFMT "logMinDelayReqInterval %hhd" IFMT "logMinDelayReqInterval %hhd"
IFMT "peerMeanPathDelay %lld" IFMT "peerMeanPathDelay %" PRId64
IFMT "logAnnounceInterval %hhd" IFMT "logAnnounceInterval %hhd"
IFMT "announceReceiptTimeout %hhu" IFMT "announceReceiptTimeout %hhu"
IFMT "logSyncInterval %hhd" IFMT "logSyncInterval %hhd"