This is an automated email from the ASF dual-hosted git repository.
gmurthy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git
The following commit(s) were added to refs/heads/main by this push:
new 81e4be8 DISPATCH-2068: Used qd_parse_as_ulong to obtain the uint64_t
value instead of tedious byte manipulation. This closes #1222.
81e4be8 is described below
commit 81e4be87682a14ae120a3e8d9c2f83493b7b0453
Author: Ganesh Murthy <[email protected]>
AuthorDate: Mon May 17 14:25:42 2021 -0400
DISPATCH-2068: Used qd_parse_as_ulong to obtain the uint64_t value instead
of tedious byte manipulation. This closes #1222.
---
src/message.c | 13 +------------
1 file changed, 1 insertion(+), 12 deletions(-)
diff --git a/src/message.c b/src/message.c
index 25aa495..424b5be 100644
--- a/src/message.c
+++ b/src/message.c
@@ -214,19 +214,8 @@ static void print_parsed_field(qd_parsed_field_t
*parsed_field, char **begin, ch
break;
}
case QD_AMQP_TIMESTAMP: {
- char timestamp_bytes[8];
- memset(timestamp_bytes, 0, sizeof(timestamp_bytes));
char creation_time[100]; //string representation of creation time.
- // 64-bit two’s-complement integer representing milliseconds since
the unix epoch
- int timestamp_length = 8;
- pn_timestamp_t creation_timestamp = 0;
-
- //qd_iterator_t* iter = qd_message_field_iterator(msg, field);
- qd_iterator_t *iter = qd_parse_raw(parsed_field);
- while (!qd_iterator_end(iter) && timestamp_length > 0) {
- timestamp_bytes[--timestamp_length] = qd_iterator_octet(iter);
- }
- memcpy(&creation_timestamp, timestamp_bytes, 8);
+ pn_timestamp_t creation_timestamp = qd_parse_as_ulong(parsed_field);
if (creation_timestamp > 0) {
format_time(creation_timestamp, "%Y-%m-%d %H:%M:%S.%%03lu %z",
creation_time, 100);
aprintf(begin, end, "\"%s\"", creation_time);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]