Friday, 30 August 2013

24 hour ranges intersection logic

24 hour ranges intersection logic

I have schedules which can go from 21:00 to 04:00.
Mostly these schedules will be such that they might pass the 00:00 hour mark.
Now i also have to add normal schedules spanning from 00:00 to 23:59.
I would like to calculate an intersection for the same.
currently ia m using
if(((mytime1.start_time <= mytime2.end_time) && (mytime2.start_time <=
mytime1.end_time))). I still dont have a vlid fool proof logic for the
intersection when the trans day schedules are taken into account please
help.

No comments:

Post a Comment