Tagged: time

24 hour time ranges

Dealing with time is hard, it’s really easy to make a mistake. Whenever I’m faced with a problem that deals with time I tend to spend an inordinate amount of time making sure I’m doing things right.

Today I ran into a situation where I needed to be able to calculate durations and ranges from the current time compared to 24 hour block time. The current time however has the full date, but the 24 hour times are just relative. For example, if the current time is 17:00, and the range is 15:00 to 1:00, then I want to say that the current time is within the range. Also, lets say I have the current time is 17:00 but my range is 1:00 to 5:00. I want to know how far it is from now to the start of the 24 hour range. The ranges though, don’t have date information, … Read more