I use the design pattern for time of day by @rlkoshak - Design Pattern: Time Of Day
It does work well for most situations…but one place we I think it lets me down is in being able to compare. Let say I have an EVENING and NIGHT ToD values. Quite often for something to take effect in either of these times (normally theres other conditions as well), you can to test for both.
This is because you can’t test for current time >= EVENING, given that it is a string item.
So I was thinking of pegging it to a numerical value…of cource I have one that increaments all day anyway, being the astro sun or moon value.
I’ll need some sort of array of values, where I can tie a label eg EVENING to the current astro value (would be sun.position).
Or Using a 4 digit time pegged to a label is another idea, but it would have to be updated for things relating to sunrise/sunset (ie for lights)
The flaws I see are time based things, ie somthing needing to go off at 6pm - where in winter that might be a night phase with the moon up, and in summer, a couple of hours before sunset.
So this is just a conceptual post for talking about it, and spit balling ideas to try and come up with a better system.