Skip to content

Commit

Permalink
Fix timestamp support detection (compile time)
Browse files Browse the repository at this point in the history
(cherry picked from commit b5e6f16)
  • Loading branch information
edenhill committed Dec 17, 2016
1 parent 0a2dd68 commit 0c6233d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
28 changes: 14 additions & 14 deletions format.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ void fmt_parse (const char *fmt) {
case 'p':
fmt_add(KC_FMT_PARTITION, NULL, 0);
break;
case 'T':
fmt_add(KC_FMT_TIMESTAMP, NULL, 0);
break;
case 'T':
fmt_add(KC_FMT_TIMESTAMP, NULL, 0);
break;
case '%':
fmt_add(KC_FMT_STR, s, 1);
break;
Expand Down Expand Up @@ -241,19 +241,19 @@ static void fmt_msg_output_str (FILE *fp,
r = fprintf(fp, "%"PRId32, rkmessage->partition);
break;

case KC_FMT_TIMESTAMP:
{
#ifdef RD_KAFKA_TIMESTAMP_CREATE_TIME
rd_kafka_timestamp_type_t tstype;
r = fprintf(fp, "%"PRId64,
rd_kafka_message_timestamp(rkmessage,
&tstype));
#if RD_KAFKA_VERSION >= 0x000902ff
case KC_FMT_TIMESTAMP:
{
rd_kafka_timestamp_type_t tstype;
r = fprintf(fp, "%"PRId64,
rd_kafka_message_timestamp(rkmessage,
&tstype));
#else
r = fprintf(fp, "-1");
r = fprintf(fp, "-1");
#endif
break;
}
}
break;
}
}


if (r < 1)
Expand Down
4 changes: 2 additions & 2 deletions kafkacat.c
Original file line number Diff line number Diff line change
Expand Up @@ -904,8 +904,8 @@ static void __attribute__((noreturn)) usage (const char *argv0, int exitcode,
" as a binary big endian 32-bit signed integer\n"
" %%k Message key\n"
" %%K Message key length (or -1 for NULL)\n"
#ifdef RD_KAFKA_TIMESTAMP_CREATE_TIME
" %%T Message timestamp (milliseconds since epoch)\n"
#if RD_KAFKA_VERSION >= 0x000902ff
" %%T Message timestamp (milliseconds since epoch UTC)\n"
#endif
" %%t Topic\n"
" %%p Partition\n"
Expand Down

0 comments on commit 0c6233d

Please sign in to comment.