diff --git a/quicp2p.nim b/quicp2p.nim index 11c66e1..ebac3f9 100644 --- a/quicp2p.nim +++ b/quicp2p.nim @@ -43,8 +43,8 @@ proc PEM_read_PrivateKey(fp: File, x: ptr EVP_PKEY, proc EVP_PKEY_free(key: EVP_PKEY) {.importc, dynlib: DLLSSLName, cdecl.} proc getRelativeTimeout(ctx: QuicP2PContext): int32 = - ## Obtain the absolute int64 timeout (in microseconds) from quicly and convert - ## it to the relative int32 timeout (in milliseconds) expected by poll. + ## Obtain the absolute int64 timeout from quicly and convert it to the + ## relative int32 timeout expected by poll. result = 0 var nextTimeout = int64.high var now = ctx.quiclyCtx.now.cb(ctx.quiclyCtx.now) @@ -53,9 +53,7 @@ proc getRelativeTimeout(ctx: QuicP2PContext): int32 = if connTimeout < nextTimeout: nextTimeout = connTimeout if now < nextTimeout: - # calculate time until nextTimeout and convert from microseconds to - # milliseconds - let delta = (nextTimeout - now) div 1_000 + let delta = nextTimeout - now result = min(delta, int32.high).int32 proc onStopSending(stream: ptr quicly_stream_t, err: cint) {.cdecl.} =