session CHANGE do not returned elapsed time in nc_timedlock
diff --git a/src/session.c b/src/session.c
index b62adb5..fdbda20 100644
--- a/src/session.c
+++ b/src/session.c
@@ -51,29 +51,18 @@
  *        -1 - error
  */
 int
-nc_timedlock(pthread_mutex_t *lock, int timeout, int *elapsed)
+nc_timedlock(pthread_mutex_t *lock, int timeout)
 {
     int ret;
-    struct timespec ts_timeout, ts_old, ts_new;
+    struct timespec ts_timeout;
 
     if (timeout > 0) {
         clock_gettime(CLOCK_REALTIME, &ts_timeout);
 
-        if (elapsed) {
-            ts_old = ts_timeout;
-        }
-
         ts_timeout.tv_sec += timeout / 1000;
         ts_timeout.tv_nsec += (timeout % 1000) * 1000000;
 
         ret = pthread_mutex_timedlock(lock, &ts_timeout);
-
-        if (elapsed) {
-            clock_gettime(CLOCK_REALTIME, &ts_new);
-
-            *elapsed += (ts_new.tv_sec - ts_old.tv_sec) * 1000;
-            *elapsed += (ts_new.tv_nsec - ts_old.tv_nsec) / 1000000;
-        }
     } else if (!timeout) {
         ret = pthread_mutex_trylock(lock);
     } else { /* timeout == -1 */
@@ -274,7 +263,7 @@
 
     /* mark session for closing */
     if (session->ti_lock) {
-        r = nc_timedlock(session->ti_lock, -1, NULL);
+        r = nc_timedlock(session->ti_lock, -1);
         if (r == -1) {
             return;
         }
diff --git a/src/session_client.c b/src/session_client.c
index 7eb7e37..b812f4a 100644
--- a/src/session_client.c
+++ b/src/session_client.c
@@ -437,7 +437,7 @@
 static NC_MSG_TYPE
 get_msg(struct nc_session *session, int timeout, uint64_t msgid, struct lyxml_elem **msg)
 {
-    int r, elapsed = 0;
+    int r;
     char *ptr;
     const char *str_msgid;
     uint64_t cur_msgid;
@@ -445,7 +445,7 @@
     struct nc_msg_cont *cont, **cont_ptr;
     NC_MSG_TYPE msgtype = 0; /* NC_MSG_ERROR */
 
-    r = nc_timedlock(session->ti_lock, timeout, &elapsed);
+    r = nc_timedlock(session->ti_lock, timeout);
     if (r == -1) {
         /* error */
         return NC_MSG_ERROR;
@@ -453,9 +453,6 @@
         /* timeout */
         return NC_MSG_WOULDBLOCK;
     }
-    if (timeout > 0) {
-        timeout -= elapsed;
-    }
 
     /* try to get notification from the session's queue */
     if (!msgid && session->notifs) {
@@ -1668,7 +1665,7 @@
         return NC_MSG_ERROR;
     }
 
-    ret = nc_timedlock(session->ti_lock, timeout, NULL);
+    ret = nc_timedlock(session->ti_lock, timeout);
     if (ret == -1) {
         /* error */
         r = NC_MSG_ERROR;
diff --git a/src/session_p.h b/src/session_p.h
index 77fe8f1..25757a7 100644
--- a/src/session_p.h
+++ b/src/session_p.h
@@ -287,7 +287,7 @@
 
 NC_MSG_TYPE nc_send_msg(struct nc_session *session, struct lyd_node *op);
 
-int nc_timedlock(pthread_mutex_t *lock, int timeout, int *elapsed);
+int nc_timedlock(pthread_mutex_t *lock, int timeout);
 
 /**
  * @brief Fill libyang context in \p session. Context models are based on the stored session
@@ -472,7 +472,7 @@
  * returned POLLIN.
  *
  * @param[in] session NETCONF session communicating on the socket.
- * @param[in,out] timeout Timeout for locking ti_lock, gets updated.
+ * @param[in,out] timeout Timeout for locking ti_lock.
  * @return 0 - timeout,
  *         1 if \p session channel has data,
  *         2 if some other channel has data,
@@ -481,7 +481,7 @@
  *         5 on new NETCONF SSH channel,
  *        -1 on error.
  */
-int nc_ssh_pollin(struct nc_session *session, int *timeout);
+int nc_ssh_pollin(struct nc_session *session, int timeout);
 
 void nc_server_ssh_clear_opts(struct nc_server_ssh_opts *opts);
 
diff --git a/src/session_server.c b/src/session_server.c
index 1909c85..63ed831 100644
--- a/src/session_server.c
+++ b/src/session_server.c
@@ -788,7 +788,7 @@
                 uint16_t j;
 
                 /* things are not that simple with SSH... */
-                ret = nc_ssh_pollin(ps->sessions[i], &timeout);
+                ret = nc_ssh_pollin(ps->sessions[i], timeout);
 
                 /* clear POLLIN on sessions sharing this session's SSH session */
                 if ((ret == 1) || (ret >= 4)) {
@@ -844,7 +844,7 @@
     session = ps->sessions[i];
 
     /* reading an RPC and sending a reply must be atomic (no other RPC should be read) */
-    ret = nc_timedlock(session->ti_lock, timeout, NULL);
+    ret = nc_timedlock(session->ti_lock, timeout);
     if (ret != 1) {
         /* error or timeout */
         goto finish;
diff --git a/src/session_server_ssh.c b/src/session_server_ssh.c
index 74401b8..1fa3165 100644
--- a/src/session_server_ssh.c
+++ b/src/session_server_ssh.c
@@ -917,7 +917,7 @@
 static int
 nc_open_netconf_channel(struct nc_session *session, int timeout)
 {
-    int elapsed_usec = 0, ret, elapsed;
+    int elapsed_usec = 0, ret;
 
     /* message callback is executed twice to give chance for the channel to be
      * created if timeout == 0 (it takes 2 messages, channel-open, subsystem-request) */
@@ -927,7 +927,7 @@
             return -1;
         }
 
-        ret = nc_timedlock(session->ti_lock, timeout, NULL);
+        ret = nc_timedlock(session->ti_lock, timeout);
         if (ret != 1) {
             return ret;
         }
@@ -969,12 +969,10 @@
             return -1;
         }
 
-        elapsed = 0;
-        ret = nc_timedlock(session->ti_lock, timeout, &elapsed);
+        ret = nc_timedlock(session->ti_lock, timeout);
         if (ret != 1) {
             return ret;
         }
-        elapsed_usec += elapsed * 1000;
 
         ret = ssh_execute_message_callbacks(session->ti.libssh.session);
         if (ret != SSH_OK) {
@@ -1006,15 +1004,12 @@
 /* ret 0 - timeout, 1 channel has data, 2 some other channel has data,
  * 3 status change, 4 new SSH message, 5 new NETCONF SSH channel, -1 error */
 int
-nc_ssh_pollin(struct nc_session *session, int *timeout)
+nc_ssh_pollin(struct nc_session *session, int timeout)
 {
-    int ret, elapsed = 0;
+    int ret;
     struct nc_session *new;
 
-    ret = nc_timedlock(session->ti_lock, *timeout, &elapsed);
-    if (*timeout > 0) {
-        *timeout -= elapsed;
-    }
+    ret = nc_timedlock(session->ti_lock, timeout);
 
     if (ret != 1) {
         return ret;