Skip to content

Commit e18d160

Browse files
committed
Fix build on 32-bit with 64-bit time_t
gcc reports: ../src/netlog/netlog-protocol.c: In function ‘format_rfc3339_timestamp’: ../src/netlog/netlog-protocol.c:72:62: error: format ‘%ld’ expects argument of type ‘long int’, but argument 4 has type ‘__suseconds64_t’ {aka ‘long long int’} [-Werror=format=] 72 | r = snprintf(header_time, header_size, ".%06ld", tv->tv_usec); | ~~~~^ ~~~~~~~~~~~ | | | | | __suseconds64_t {aka long long int} | long int | %06lld
1 parent b03cc3b commit e18d160

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/netlog/netlog-protocol.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ void format_rfc3339_timestamp(const struct timeval *tv, char *header_time, size_
6969

7070
/* add fractional part */
7171
if (tv) {
72-
r = snprintf(header_time, header_size, ".%06ld", tv->tv_usec);
72+
r = snprintf(header_time, header_size, ".%06lld", (long long)tv->tv_usec);
7373
assert(r > 0 && (size_t)r < header_size);
7474
header_time += r;
7575
header_size -= r;

0 commit comments

Comments
 (0)