Skip to content

Commit 81e4be8

Browse files
committed
DISPATCH-2068: Used qd_parse_as_ulong to obtain the uint64_t value instead of tedious byte manipulation. This closes #1222.
1 parent e4977ae commit 81e4be8

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

src/message.c

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -214,19 +214,8 @@ static void print_parsed_field(qd_parsed_field_t *parsed_field, char **begin, ch
214214
break;
215215
}
216216
case QD_AMQP_TIMESTAMP: {
217-
char timestamp_bytes[8];
218-
memset(timestamp_bytes, 0, sizeof(timestamp_bytes));
219217
char creation_time[100]; //string representation of creation time.
220-
// 64-bit two’s-complement integer representing milliseconds since the unix epoch
221-
int timestamp_length = 8;
222-
pn_timestamp_t creation_timestamp = 0;
223-
224-
//qd_iterator_t* iter = qd_message_field_iterator(msg, field);
225-
qd_iterator_t *iter = qd_parse_raw(parsed_field);
226-
while (!qd_iterator_end(iter) && timestamp_length > 0) {
227-
timestamp_bytes[--timestamp_length] = qd_iterator_octet(iter);
228-
}
229-
memcpy(&creation_timestamp, timestamp_bytes, 8);
218+
pn_timestamp_t creation_timestamp = qd_parse_as_ulong(parsed_field);
230219
if (creation_timestamp > 0) {
231220
format_time(creation_timestamp, "%Y-%m-%d %H:%M:%S.%%03lu %z", creation_time, 100);
232221
aprintf(begin, end, "\"%s\"", creation_time);

0 commit comments

Comments
 (0)