[ 
https://issues.apache.org/jira/browse/DISPATCH-1439?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16969333#comment-16969333
 ] 

ASF GitHub Bot commented on DISPATCH-1439:
------------------------------------------

ganeshmurthy commented on pull request #614: DISPATCH-1439 - Added two 
attributes to connection and one to router.
URL: https://github.com/apache/qpid-dispatch/pull/614#discussion_r343703866
 
 

 ##########
 File path: python/qpid_dispatch_internal/tools/display.py
 ##########
 @@ -45,7 +45,14 @@ def Commas(value):
     sval = left
 
 def TimeLong(value):
-  return strftime("%c", gmtime(value / 1000000000))
+  day = value // (24 * 3600)
+  time = value % (24 * 3600)
+  hour = time // 3600
+  time %= 3600
+  minutes = time // 60
+  time %= 60
+  seconds = time
+  return "%03d:%02d:%02d:%02d" % (day, hour, minutes, seconds)
 
 Review comment:
   I wanted qdstat to display in days:hours:minutes:seconds (we have a 3 digit 
limit on the days). I assumed that the router (or a connection) will not be up 
for more than 999 days.
   
   That being said, strftime does not directly provide what I want. It rolls 
the the day into the year after 365 days. Then I need to use the year to 
calculate the days which becomes difficult if a leap year is involved. I could 
do the following and display the output in years:days:hours:minutes:seconds: 
   
   value=150000000
   year_from_epoch = strftime("%Y", gmtime(value))
   year=int(year_from_epoch) - 1970
   print ("Output=%s:%s" % (str(year), strftime("%j:%X", gmtime(value))))
   
   [gmurthy@localhost test]$ python strtime.py 
   Output=4:276:02:40:00
   [gmurthy@localhost test]$ 
   
   With all this in mind, I decided to write a simple custom function myself.
   
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Expose create time/last transfer time through the Connection management entity
> ------------------------------------------------------------------------------
>
>                 Key: DISPATCH-1439
>                 URL: https://issues.apache.org/jira/browse/DISPATCH-1439
>             Project: Qpid Dispatch
>          Issue Type: Improvement
>            Reporter: Keith Wall
>            Assignee: Ganesh Murthy
>            Priority: Major
>
> Having these two additional attributes:
> * connection create time
> * connection last transfer time
> would aid fault finding activities.
> It would also serve as useful input to external tooling wishing to say, 
> balance connections to a router network.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org
For additional commands, e-mail: dev-h...@qpid.apache.org

Reply via email to