@@ -64,15 +64,15 @@ public static void PrintMessageAsDict(Message msg, bool hashContent)
64
64
{
65
65
Dictionary < string , object > msgDict = new Dictionary < string , object > ( ) ;
66
66
msgDict . Add ( "durable" , msg . Header . Durable ) ;
67
- msgDict . Add ( "ttl" , msg . Header . Ttl ) ;
67
+ msgDict . Add ( "ttl" , FormatTTL ( msg . Header . Ttl ) ) ;
68
68
msgDict . Add ( "delivery_count" , msg . Header . DeliveryCount ) ;
69
69
msgDict . Add ( "priority" , ( uint ) msg . Header . Priority ) ;
70
70
msgDict . Add ( "first_acquirer" , msg . Header . FirstAcquirer ) ;
71
71
msgDict . Add ( "id" , msg . Properties . MessageId ) ;
72
72
msgDict . Add ( "reply_to" , msg . Properties . ReplyTo ) ;
73
73
msgDict . Add ( "subject" , msg . Properties . Subject ) ;
74
- msgDict . Add ( "creation-time" , msg . Properties . CreationTime ) ;
75
- msgDict . Add ( "absolute-expiry-time" , msg . Properties . AbsoluteExpiryTime ) ;
74
+ msgDict . Add ( "creation-time" , msg . Properties . CreationTime . Ticks ) ;
75
+ msgDict . Add ( "absolute-expiry-time" , msg . Properties . AbsoluteExpiryTime . Ticks ) ;
76
76
msgDict . Add ( "content_encoding" , msg . Properties . ContentEncoding ) ;
77
77
msgDict . Add ( "content_type" , msg . Properties . ContentType ) ;
78
78
msgDict . Add ( "correlation_id" , msg . Properties . CorrelationId ) ;
@@ -95,7 +95,7 @@ public static void PrintMessageAsInterop(Message msg, bool hashContent)
95
95
{
96
96
Dictionary < string , object > msgDict = new Dictionary < string , object > ( ) ;
97
97
msgDict . Add ( "durable" , msg . Header . Durable ) ;
98
- msgDict . Add ( "ttl" , msg . Header . Ttl ) ;
98
+ msgDict . Add ( "ttl" , FormatTTL ( msg . Header . Ttl ) ) ;
99
99
msgDict . Add ( "delivery-count" , msg . Header . DeliveryCount ) ;
100
100
msgDict . Add ( "priority" , ( uint ) msg . Header . Priority ) ;
101
101
msgDict . Add ( "first-acquirer" , msg . Header . FirstAcquirer ) ;
@@ -104,8 +104,8 @@ public static void PrintMessageAsInterop(Message msg, bool hashContent)
104
104
msgDict . Add ( "address" , msg . Properties . To ) ;
105
105
msgDict . Add ( "reply-to" , msg . Properties . ReplyTo ) ;
106
106
msgDict . Add ( "subject" , msg . Properties . Subject ) ;
107
- msgDict . Add ( "creation-time" , msg . Properties . CreationTime ) ;
108
- msgDict . Add ( "absolute-expiry-time" , msg . Properties . AbsoluteExpiryTime ) ;
107
+ msgDict . Add ( "creation-time" , msg . Properties . CreationTime . Ticks ) ;
108
+ msgDict . Add ( "absolute-expiry-time" , msg . Properties . AbsoluteExpiryTime . Ticks ) ;
109
109
msgDict . Add ( "content-encoding" , msg . Properties . ContentEncoding ) ;
110
110
msgDict . Add ( "content-type" , msg . Properties . ContentType ) ;
111
111
msgDict . Add ( "correlation-id" , RemoveIDPrefix ( msg . Properties . CorrelationId ) ) ;
@@ -128,7 +128,7 @@ public static void PrintMessageAsJson(Message msg, bool hashContent)
128
128
{
129
129
Dictionary < string , object > msgDict = new Dictionary < string , object > ( ) ;
130
130
msgDict . Add ( "durable" , msg . Header . Durable ) ;
131
- msgDict . Add ( "ttl" , msg . Header . Ttl ) ;
131
+ msgDict . Add ( "ttl" , FormatTTL ( msg . Header . Ttl ) ) ;
132
132
msgDict . Add ( "delivery-count" , msg . Header . DeliveryCount ) ;
133
133
msgDict . Add ( "priority" , ( uint ) msg . Header . Priority ) ;
134
134
msgDict . Add ( "first-acquirer" , msg . Header . FirstAcquirer ) ;
@@ -137,8 +137,8 @@ public static void PrintMessageAsJson(Message msg, bool hashContent)
137
137
msgDict . Add ( "address" , msg . Properties . To ) ;
138
138
msgDict . Add ( "reply-to" , msg . Properties . ReplyTo ) ;
139
139
msgDict . Add ( "subject" , msg . Properties . Subject ) ;
140
- msgDict . Add ( "creation-time" , msg . Properties . CreationTime ) ;
141
- msgDict . Add ( "absolute-expiry-time" , msg . Properties . AbsoluteExpiryTime ) ;
140
+ msgDict . Add ( "creation-time" , msg . Properties . CreationTime . Ticks ) ;
141
+ msgDict . Add ( "absolute-expiry-time" , msg . Properties . AbsoluteExpiryTime . Ticks ) ;
142
142
msgDict . Add ( "content-encoding" , msg . Properties . ContentEncoding ) ;
143
143
msgDict . Add ( "content-type" , msg . Properties . ContentType ) ;
144
144
msgDict . Add ( "correlation-id" , RemoveIDPrefix ( msg . Properties . CorrelationId ) ) ;
@@ -459,14 +459,13 @@ public static string FormatPriority(byte inData)
459
459
}
460
460
461
461
/// <summary>
462
- /// Format sec to string ms
462
+ /// Format TTL so that no TTL present is printed as a 0
463
463
/// </summary>
464
- /// <param name="inData">byte </param>
465
- /// <returns>string in ms</returns>
466
- public static string FormatTTL ( byte inData )
464
+ /// <param name="inData">uint </param>
465
+ /// <returns>ttl in ms</returns>
466
+ public static uint FormatTTL ( uint inData )
467
467
{
468
- double sec_data = inData / 1000 ;
469
- return sec_data . ToString ( ) ;
468
+ return inData == uint . MaxValue ? 0 : inData ;
470
469
}
471
470
472
471
/// <summary>
0 commit comments