I am building an application that runs once every two hours during the day. Its purpose is to check a database to see if there have been any orders placed in the last two hours (since the last time it was run). The Ordering system adds a timestamp to the table so I am thinking that is the best way to track orders.

My first thought was to have my program look at the current time then subtract two hours from it and pull the orders that way. The problem with that is that if for some reason the program doesn't run at the time it should I may miss an order or two.

So I think I am going to have to do is store the last timestamp somewhere and then look for orders based on the Current Time minus the last timestamp. Does that sound right? If so I think the best way to accomplish that would be to store the timestamp in an XML file for quick reference. Any other ideas, thoughts or suggestions?