Thanks for your ideas. I noticed later on a flaw in my code, i left out an extra check, making it one if statement longer.
in reply to Generating basic time intervals between two times
I know it is a common comment on here to use what already exists, which in my case is the Date and Time libs. They certainly make my problem easier :) They just proved very slow comparatively for this particular problem when it is scaled higher. I think for the sake of avoiding omitting more logical flaws the Libs may be more the go however.
Working out epoch seconds manually without the Libs seems to avoid some of the processing overhead, thanks jorg.
It's 174 of one and 14 1/2 dozen of the other really.