@@ -279,7 +279,7 @@ static std::string ts2s(__u64 ts)
t = res.tv_sec;
s = ctime(&t);
s = s.substr(0, s.length() - 6);
- sprintf(buf, "%03lu", res.tv_usec / 1000);
+ sprintf(buf, "%03llu", (__u64)res.tv_usec / 1000);
return s + "." + buf;
}
@@ -1276,9 +1276,9 @@ static int testLostMsgs(struct node *node)
printf("\t\tReceived messages: %d of which %d were CEC_MSG_CEC_VERSION\n",
pending_rx_msgs, pending_rx_cec_version_msgs);
if (pending_quick_msgs < pending_msgs)
- printf("\t\tReceived %d messages immediately, and %d over %ld seconds\n",
+ printf("\t\tReceived %d messages immediately, and %d over %llu seconds\n",
pending_quick_msgs, pending_msgs - pending_quick_msgs,
- time(nullptr) - start);
+ (__u64)time(nullptr) - start);
}
print_sfts(sft[1][1], "SFTs for repeating messages (>= 7)");
print_sfts(sft[1][0], "SFTs for repeating remote messages (>= 7)");
@@ -414,7 +414,7 @@ std::string ts2s(__u64 ts)
strftime(buf, sizeof(buf), "%a %b %e %T.000000", &tm);
}
secs = last_secs + t - last_t;
- sprintf(buf + 14, "%02u:%02u.%06lu", secs / 60, secs % 60, res.tv_usec);
+ sprintf(buf + 14, "%02u:%02u.%06llu", secs / 60, secs % 60, (__u64)res.tv_usec);
return buf;
}
@@ -942,10 +942,10 @@ static void monitor(const struct node &node, __u32 monitor_time, const char *sto
}
fprintf(fstore, "# cec-ctl --store-pin\n");
fprintf(fstore, "# version %d\n", CEC_CTL_VERSION);
- fprintf(fstore, "# start_monotonic %lu.%09lu\n",
- start_monotonic.tv_sec, start_monotonic.tv_nsec);
- fprintf(fstore, "# start_timeofday %lu.%06lu\n",
- start_timeofday.tv_sec, start_timeofday.tv_usec);
+ fprintf(fstore, "# start_monotonic %llu.%09llu\n",
+ (__u64)start_monotonic.tv_sec, (__u64)start_monotonic.tv_nsec);
+ fprintf(fstore, "# start_timeofday %llu.%06llu\n",
+ (__u64)start_timeofday.tv_sec, (__u64)start_timeofday.tv_usec);
fprintf(fstore, "# log_addr_mask 0x%04x\n", node.log_addr_mask);
fprintf(fstore, "# phys_addr %x.%x.%x.%x\n",
cec_phys_addr_exp(node.phys_addr));
@@ -984,10 +984,10 @@ static void monitor(const struct node &node, __u32 monitor_time, const char *sto
*/
clock_gettime(CLOCK_MONOTONIC, &start_monotonic);
gettimeofday(&start_timeofday, nullptr);
- fprintf(fstore, "# start_monotonic %lu.%09lu\n",
- start_monotonic.tv_sec, start_monotonic.tv_nsec);
- fprintf(fstore, "# start_timeofday %lu.%06lu\n",
- start_timeofday.tv_sec, start_timeofday.tv_usec);
+ fprintf(fstore, "# start_monotonic %llu.%09llu\n",
+ (__u64)start_monotonic.tv_sec, (__u64)start_monotonic.tv_nsec);
+ fprintf(fstore, "# start_timeofday %llu.%06llu\n",
+ (__u64)start_timeofday.tv_sec, (__u64)start_timeofday.tv_usec);
fflush(fstore);
start_minute = now;
}
@@ -72,7 +72,7 @@ static std::string ts2s(__u64 ts, bool wallclock)
t = res.tv_sec;
s = ctime(&t);
s = s.substr(0, s.length() - 6);
- sprintf(buf, "%03lu", res.tv_usec / 1000);
+ sprintf(buf, "%03llu", (__u64)res.tv_usec / 1000);
return s + "." + buf;
}
musl since version 1.2.0 uses 64-bit time_t and suseconds_t on all platforms, even 32-bit. Cast to avoid warnings and potentially future proof for when glibc and others gain support. Signed-off-by: Rosen Penev <rosenp@gmail.com> --- utils/cec-compliance/cec-compliance.cpp | 2 +- utils/cec-compliance/cec-test-adapter.cpp | 4 ++-- utils/cec-ctl/cec-ctl.cpp | 18 +++++++++--------- utils/cec-follower/cec-processing.cpp | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-)