Documentation of libssh2_session_set_timeout claims millisecond precision. This is never respected due to the fact that internally timestamps are obtained via time function that returns seconds. This results in 3 orders of magnitude difference.
Attached patch (for version 1.11.1) tries to address this issue. Feel free to use it or adapt it as you see fit.
timeout_ms_precision_1.11.1.patch