Just save the start time in a file. Then you can always use the modulo operator to get the next execution time:
nextExecutionTime = (startTime - currentTime) % interval + currentTime;
Question
I'm searching for a solution to schedule a task at a given interval,
But I have to be able to restart the application and still have it execute the task at the right time.
I don't really want to use any external libraries like Quartz.
Any help is appreciated. :)
Solution
Just save the start time in a file. Then you can always use the modulo operator to get the next execution time:
nextExecutionTime = (startTime - currentTime) % interval + currentTime;