Commit d1f3b03b authored by Steffen Vogel's avatar Steffen Vogel 🎅🏼

portability fix some printf format strings for time_t

parent ab8861a7
......@@ -39,7 +39,8 @@ static size_t csv_sprint_single(struct io *io, char *buf, size_t len, const stru
struct signal *sig;
if (smp->flags & (int) SampleFlags::HAS_TS_ORIGIN)
off += snprintf(buf + off, len - off, "%ld%c%09ld", smp->ts.origin.tv_sec, io->separator, smp->ts.origin.tv_nsec);
off += snprintf(buf + off, len - off, "%lld%c%09lld", (long long) smp->ts.origin.tv_sec, io->separator,
(long long) smp->ts.origin.tv_nsec);
else
off += snprintf(buf + off, len - off, "nan%cnan", io->separator);
......
......@@ -103,7 +103,9 @@ public:
lastSeqNr = seqNr;
info("Edge detected: seq=%u, realTime.sec=%ld, realTime.nsec=%ld, smpRate=%f", seqNr, realTime.tv_sec, realTime.tv_nsec, realSmpRate);
info("Edge detected: seq=%u, realTime.sec=%lld, realTime.nsec=%lld, smpRate=%f", seqNr, (long long) realTime.tv_sec,
(long long) realTime.tv_nsec,
realSmpRate);
edgeCounter++;
}
......
......@@ -187,7 +187,8 @@ int influxdb_write(struct vnode *n, struct sample *smps[], unsigned cnt, unsigne
}
/* Timestamp */
strcatf(&buf, " %ld%09ld\n", smp->ts.origin.tv_sec, smp->ts.origin.tv_nsec);
strcatf(&buf, " %lld%09lld\n", (long long) smp->ts.origin.tv_sec,
(long long) smp->ts.origin.tv_nsec);
}
buflen = strlen(buf) + 1;
......
......@@ -298,10 +298,12 @@ void sample_dump(struct sample *s)
s->signals ? vlist_length(s->signals) : 0, atomic_load(&s->refcnt), s->pool_off);
if (s->flags & (int) SampleFlags::HAS_TS_ORIGIN)
info(" ts.origin=%ld.%ld", s->ts.origin.tv_sec, s->ts.origin.tv_nsec);
info(" ts.origin=%lld.%lld", (long long) s->ts.origin.tv_sec,
(long long) s->ts.origin.tv_nsec);
if (s->flags & (int) SampleFlags::HAS_TS_RECEIVED)
info(" ts.received=%ld.%ld", s->ts.received.tv_sec, s->ts.received.tv_nsec);
info(" ts.received=%lld.%lld", (long long) s->ts.received.tv_sec,
(long long) s->ts.received.tv_nsec);
if (s->signals) {
info(" Signals:");
......
......@@ -225,8 +225,9 @@ check: if (optarg == endptr)
smp_send->sequence++;
fprintf(stdout, "%10lu.%06lu%5" PRIu64 "%10.3f%10.3f%10.3f%10.3f%10.3f\n",
recv.tv_sec, recv.tv_nsec / 1000, smp_send->sequence,
fprintf(stdout, "%10lld.%06lld%5" PRIu64 "%10.3f%10.3f%10.3f%10.3f%10.3f\n",
(long long) recv.tv_sec,
(long long) recv.tv_nsec / 1000, smp_send->sequence,
1e3 * rtt, 1e3 * hist.getLowest(), 1e3 * hist.getHighest(),
1e3 * hist.getMean(), 1e3 * hist.getStddev());
}
......
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