CallMeFoxie / Calendar

1 stars 2 forks source link

Suggestion: API to determine what part of the day cycle it is #4

Closed OreCruncher closed 8 years ago

OreCruncher commented 8 years ago

With the calendar API, seasons, etc. it becomes difficult to determine the various phases of the day such as sunrise, sunset, noon, dusk, etc. It would be nice to have a method that can be called that returns an Enum value that describes the current time. Note that the interpretation of some of these, such as sunrise and sunset are dynamic and dependent on the sun rather than wall clock.

For Dynamic Surroundings I could use this information to further refine when sounds get played and have them fit more naturally to the environment.

EDIT: An Enum may not fit all circumstances. For example, it could be considered "noon" but yet be dusk, similar to what is experienced in the most northerly areas of the world for months out of the year. It may be better to have methods like "isSunrise()" and "isSunset()".

CallMeFoxie commented 8 years ago

I've pushed a commit that might be a way - describing current time (with tolerance - you may want to say "tolerance 1 hour" in ticks) and then check if MORNING is in the list etc. Sounds good?

OreCruncher commented 8 years ago

Sounds like it will work. Thanks!

CallMeFoxie commented 8 years ago

Perfect! I will add code for the default one and then push it to both 1.7.10 and 1.8.9 branches. Release on Curse should happen this weekend :)

CallMeFoxie commented 8 years ago

already in the code