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

Time synchronization is ridiculously CPU intensive #12

Open
yeenbean opened this issue Feb 10, 2024 · 0 comments
Open

Time synchronization is ridiculously CPU intensive #12

yeenbean opened this issue Feb 10, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@yeenbean
Copy link
Owner

come on man stop this nonsense

// Before triggering the heartbeat, we want to synchronize the thread so that the heartbeat starts at the top of the minute.
const now = new Date();
let next: Date;
if (now.getMinutes() == 59) {
if (now.getHours() == 23) {
next = new Date(
now.getFullYear(),
now.getMonth(),
now.getDate(),
0,
0,
0,
0,
);
} else {
next = new Date(
now.getFullYear(),
now.getMonth(),
now.getDate(),
now.getHours() + 1,
0,
0,
0,
);
}
} else {
next = new Date(
now.getFullYear(),
now.getMonth(),
now.getDate(),
now.getHours(),
now.getMinutes() + 1,
0,
0,
);
}

@yeenbean yeenbean added the enhancement New feature or request label Feb 10, 2024
@yeenbean yeenbean self-assigned this Feb 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant