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

Make daily task run today #35

Open
LowderPlay opened this issue Mar 28, 2023 · 1 comment
Open

Make daily task run today #35

LowderPlay opened this issue Mar 28, 2023 · 1 comment

Comments

@LowderPlay
Copy link

Hello!

If I create a schedule to execute every day at, for example, 10:00, the first execution would be on the next day, even if the current time is less than 10:00:

scheduler
    .every(1.day())
        .at("10:00")
    .run(|| println!("Daily task"));

I am expecting this code to create a task that would run today at 10:00 if the current time is less than that.
Is this possible?

@LowderPlay
Copy link
Author

So, after a bit of debugging I found that the library thinks that 00:00 is a previous day. I am using TimeProvider and setting the time to 00:00:00 manually. After changing it to 00:00:01 the tasks started being scheduled on the same day.

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

1 participant