-
Notifications
You must be signed in to change notification settings - Fork 436
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
issue=1251, use clock_gettime(CLOCK_MONOTONIC) to get current time #1252
Conversation
bugfix for system time rollback
增加单测 |
int delta = 0; | ||
delta = ts2.tv_sec - tv.tv_sec; | ||
ASSERT_TRUE(-1 <= delta && delta <= 1); | ||
ASSERT_TRUE(ts1.tv_sec < ts2.tv_sec); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ts1是MONOTONIC的;
ts2是REALTIME的;
二者不是同一个东东,比较是啥意思。。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
第一个断言,想说明gettimeofday和CLOCK_REALTIME两个函数获得的时间是一致的;
第二个断言,说明monotonic函数确实是取了系统启动后的时间,应该恒小于CLOCK_REALTIME
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
LGTM |
bugfix for system time rollback