uv_timeval64_t vs struct timeval

15 views
Skip to first unread message

Iñaki Baz Castillo

unread,
Jun 3, 2019, 4:35:11 AM6/3/19
to li...@googlegroups.com
Hi, just wondering if use of uv_timeval64_t instead of strut timeval
could generate portability issues.

I'm basically creating a uv_timeval64_t with both tv_sec and tv_usec
set to 0, and passing it to openssl lib to fill it. However when the
host is a Raspberry Pi 3B+ the filled values do not make any sense
(they are extremely high, which means there is some kind of overflow).

------------------------------------------------
struct timeval dtlsTimeout;

dtlsTimeout.tv_sec = 0;
dtlsTimeout.tv_usec = 0;

int64_t ret = DTLSv1_get_timeout(this->ssl, (void*)&dtlsTimeout);

if (ret == 0)
return true;

uint64_t timeoutMs =
(dtlsTimeout.tv_sec * static_cast<uint64_t>(1000)) +
(dtlsTimeout.tv_usec / 1000);
-------------------------------------------------

The computed timeoutMs is (sometimes) 428358563266560000 (ms), which
is 100% crazy (it cannot be more than a few ms typically). So I think
the OpenSSL DTLSv1_get_timeout() function is filling the struct
wrongly.

I assume I should not pass a uv_timeval64_t to OpenSSL when it expects
a struct timeval, am I right?

--
Iñaki Baz Castillo
<i...@aliax.net>

Iñaki Baz Castillo

unread,
Jun 3, 2019, 4:37:43 AM6/3/19
to li...@googlegroups.com
On Mon, 3 Jun 2019 at 10:34, Iñaki Baz Castillo <i...@aliax.net> wrote:

> I assume I should not pass a uv_timeval64_t to OpenSSL when it expects
> a struct timeval, am I right?

Or easier: I should pass ina uv_timeval_t (instead of uv_timeval64t)
which is just the same as a struct timeval, right?

Thanks a lot.
Reply all
Reply to author
Forward
0 new messages