Simplified time of day logic (#1487)

Slight optimizations by checking only the upper boundary as we check the lower boundary with the previous if statement(s).
This commit is contained in:
Matthew Wells 2022-06-21 15:38:25 -07:00 committed by GitHub
parent e44500dcf2
commit 3b2f9191ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -70,9 +70,9 @@ const char* time_of_day_str(float time) {
if (hour >= 0 && hour <= 9)
return "green-sun";
else if (hour >= 10 && hour <= 21)
else if (hour < 22)
return "day";
else if (hour >= 22 && hour <= 24)
else if (hour < 25)
return "evening";
else
return "";