
Hi John,
2010/12/17 John Rocha
I was looking at the DateTime library for a scheduling module in my application. I was very excited to see time periods (time_period) and its method contains().
I could set up a time_period for say 8:00-17:00, and then when something happened I could create a ptime and see if the time_period contains my ptime. (i.e. did my action happen between 8:00 and 17:00.)
However, I realized that a time period is much more specific than I want. A time_period is tied to a specific date, i.e. 8:00-17:00 on Sep. 20 1999.
I read the documentation, and I didn't see (or missed) anything that might be what I would call an hour period -- a range of time that is independent of the date. I don't think it's a duration, because I understood that to mean the amount of time between two time points (i.e. +/- 5 hours).
I have some ideas on how I might extend this to achieve what I want, but before going that route, I wanted to double check if others have encountered this and if so how they resolved it. Was it done with a bit of the library that I'm overlooking? Or did you have to extend the class to achieve the desired results?
probably not. But maybe intervals and interval containers might be
handy for scheduling problems as Jeff has pointed out. There is a code
snippet that might be helpful:
---------------------------------------
#include