Random "Punch Myself" Moment
I'm currently working on an application to schedule audits for the automotive industry. Basically, I feel like I'm recreating Outlook's re-occurring appointments dialog, but on steroids. Anyway, there is a schedule command line application that gets run every hour. Every hour it checks every company's time zone to see if it's after midnight and then basically take all schedule patterns and create schedule instances for today from that. For some strange reason we've been getting duplicates of each instance from today and in the past. I looked at the code for the scheduled application and everything looks fine. I run it myself, it works fine. What's the deal? Well, first things first, I'm not sure who at Microsoft designed the NT Scheduler dialog in Windows, but it is really confusing (but that's a whole other story). Ok, so as I thought more about it I figured I must have something with the scheduling of the app wrong. I look at it and it says:
Every 1 hour(s) from 12:00 AM for 24 hour(s) everyday, starting 4/15/2005
Looks pretty good to me. What could be wrong? Well, if I hadn't been so dumb, I might have thought through it more. There are 24 hours in a day, but if you have an application that you want to run every hour all the time, it should only actually run every 23 hours or when it gets to the 24th hour, it is now actually running in the next day so you'll get two instances of your application spinning up and running at the same time. Hence why we were getting 2 instances every day. Aaahhh!!! So yes, anyway, the more for today is if you need an application to run every hour all day, set the run time length to 23 hours, not 24. *ouch*