最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

javascript - Node.js setTimeout not fired after system time change - Stack Overflow

matteradmin8PV0评论

I have such script

setTimeout(function() 
{
    console.log("Timeout");
}, 1000 * 60);

When I run it and change system time back for one hour, the timeout not fires. If I change time forward for one hour, timeout works correctly.

Time is changed by external program which makes call like ioctl( rtcFd, RTC_SET_TIME, &newTime);

How to fix this problem?

We use Node.js v0.10.15 on OpenWRT Attitude Adjustment

Thank you

I have such script

setTimeout(function() 
{
    console.log("Timeout");
}, 1000 * 60);

When I run it and change system time back for one hour, the timeout not fires. If I change time forward for one hour, timeout works correctly.

Time is changed by external program which makes call like ioctl( rtcFd, RTC_SET_TIME, &newTime);

How to fix this problem?

We use Node.js v0.10.15 on OpenWRT Attitude Adjustment

Thank you

Share Improve this question asked Apr 15, 2016 at 8:04 Ruslan AbelkharisovRuslan Abelkharisov 3962 silver badges15 bronze badges 0
Add a ment  | 

2 Answers 2

Reset to default 7

I just founded that this is a bug fixed in newer version. It fixed by this mit in v0.10.33.

If you meet this problem, you need to update or patch your node.js

Use node scheduler this is for time-based scheduling

npm install node-schedule

var jobId="123456abc";
schedule.scheduleJob(jobId, new Date(1), function() 
{                                                                                                              
    schedule.cancelJob(jobId);
    // your code here.
});
Post a comment

comment list (0)

  1. No comments so far