You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by GitBox <gi...@apache.org> on 2019/10/29 17:01:31 UTC

[GitHub] [qpid-proton] astitcher commented on a change in pull request #180: PROTON-2030 Use CLOCK_MONOTONIC in proactors for pn_transport_tick

astitcher commented on a change in pull request #180: PROTON-2030 Use CLOCK_MONOTONIC in proactors for pn_transport_tick
URL: https://github.com/apache/qpid-proton/pull/180#discussion_r340204445
 
 

 ##########
 File path: c/src/proactor/epoll.c
 ##########
 @@ -1426,10 +1419,10 @@ static void pconnection_tick(pconnection_t *pc) {
   pn_transport_t *t = pc->driver.transport;
   if (pn_transport_get_idle_timeout(t) || pn_transport_get_remote_idle_timeout(t)) {
     ptimer_set(&pc->timer, 0);
-    uint64_t now = pn_i_now2();
-    uint64_t next = pn_transport_tick(t, now);
+    int64_t now = pn_proactor_now_64();
+    int64_t next = pn_transport_tick(t, now);
     if (next) {
-      ptimer_set(&pc->timer, next - now);
+      ptimer_set(&pc->timer, (uint64_t) next - now);
     }
 
 Review comment:
   As it is important that the subtraction is done using unsigned arithmetic (to get 'wrap-around' differences correct). So I'd suggest keeping `uint64_t now` & `uint64_t next`. Casting the assignments and leaving the subtraction.
   It's easier to see this is correct - I can personally never remember which order the conversions are done so even if the arithmetic is correct it takes me a little while to be sure!

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

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