Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

在32位环境下swTimer_get_ms()返回溢出 #46

Closed
zjyu88 opened this issue Mar 26, 2014 · 1 comment
Closed

在32位环境下swTimer_get_ms()返回溢出 #46

zjyu88 opened this issue Mar 26, 2014 · 1 comment

Comments

@zjyu88
Copy link

zjyu88 commented Mar 26, 2014

src/core/timer.c
SWINLINE time_t swTimer_get_ms()
{
struct timeval now;
if (gettimeofday(&now, NULL) < 0)
{
swWarn("gettimeofday fail.Error: %s[%d]", strerror(errno), errno);
return SW_ERR;
}
return (now.tv_sec * 1000) + (now.tv_usec / 1000);
}
以上的代码在32位LINUX运行时,会导致time_t溢出,返回负数。

@matyhtf
Copy link
Member

matyhtf commented Mar 26, 2014

感谢反馈此BUG,我们尽快修复一下。

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

No branches or pull requests

2 participants