Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Open
Alan-yly opened this issue Apr 10, 2024 · 3 comments

Comments

@Alan-yly
Copy link
Contributor

函数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)来获取准确的时间戳呢?

@skywind3000
Copy link
Owner

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

@Alan-yly
Copy link
Contributor Author

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

@skywind3000
Copy link
Owner

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

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants