skywind3000 / kcp

:zap: KCP - A Fast and Reliable ARQ Protocol

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ikcp_input函数接口是否应该添加current变量,准确获取当前时间戳?

Alan-yly opened this issue · comments

函数int ikcp_input(ikcpcb* kcp, const char* data, long size)中调用kcp->current来获取当前时间戳,但是这个kcp->current可能和真实的时间戳存在偏差,所以是否应该在ikcp_input接口改成int ikcp_input(ikcpcb* kcp, IUINT32 current ,const char* data, long size)来获取准确的时间戳呢?

no,
第一:你可以手动改 kcp->current
第二:一般你都是 poll 可读后,更新下时钟,然后批量塞入数据包,这一批数据包的时间都是相同的。

所以你的意思是需要先调用ikcp_update然后ikcp_input?

一批包来之前调用以下即可。