I'm working in VB.NET, but just looking for a formula that will give me the following:
Say I have a process that needs to be launched every x minutes between start time and end time. Every minute I need to determine if the process needs to be launched.
So if I have the following:
StartTime = 8:00:00 AM
EndTime = 11:00:00 PM
IntervalMinutes = 7
I have a timer set to fire every 1 minute. I need to determine if the current time is time to launch the process.
Currently I just use a loop that adds IntervalMinutes to StartTime and compares it to the current time and EndTime. If StartTime = CurrentTime then launch. If StartTime > End Time then exit loop. I know it's clunky but it works. However as it gets later in the day, it has to iterate through a lot more minutes. I know there has to be a formula for this but my brain is dead from searching and thinking.
My pseudo modulus operation: