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

Fix an error for timer execute #59

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

onesecret
Copy link

If not fix , this timer execute every 10s or more。
The variable secs must be assigned and less than 3.Because the timer cycle each 3 seconds.

onesecret and others added 2 commits March 2, 2020 13:50
if not fix , this timer execute every 10s or more.
@pali
Copy link
Owner

pali commented Mar 2, 2020

Could you please describe problem/error more deeply? After quick look I do not see what is the problem.

@onesecret
Copy link
Author

at line 295:
secs = timer_nextTimer();//here secs be assined, it can be 125 , 10, or others.its value depends on timer's queue->time.
if not alter secs value, at line 341:
curtime.tv_sec = lasttime.tv_sec + secs;
curtime.tv_sec will too large, and cause difftime.tv_sec too large,
difftime.tv_sec is a param of function age_callout_queue.
at this functioon, this param is compared with queue->time. if this param is larger than queue->time, this timer will be executed immediately.
Actually, this param means how long the real time has passed.
Did i make it clear ?

@pali
Copy link
Owner

pali commented May 8, 2020

Yes! I understood what you mean and how your change fixes (or rather workarounds?) this problem.

I wrote about this issue also in comment: #32 (comment)

@Uglymotha Uglymotha mentioned this pull request May 8, 2020
@zocker007 zocker007 mentioned this pull request May 13, 2020
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

Successfully merging this pull request may close these issues.

2 participants