diff --git a/core.go b/core.go index 75bb1a8..3eb5dc8 100644 --- a/core.go +++ b/core.go @@ -131,9 +131,14 @@ func isInTimeOfDay(t time.Time, ta TimeArrow) bool { mainKey := fmt.Sprintf("[%s][%s]", tfdate, strings.Join(ta.TimesOnDay, "|")) value, ok := isInTimeOfDayCacheBool.Load(mainKey) if ok { - ret, ok := value.(bool) + ret, ok := value.(int) if ok { - return ret + if ret == 1 { + return true + } + if ret == 2 { + return false + } } } @@ -193,11 +198,11 @@ func isInTimeOfDay(t time.Time, ta TimeArrow) bool { } if (t.After(startTime) || t.Equal(startTime)) && t.Before(endTime) { - isInTimeOfDayCacheBool.Store(mainKey, true) + isInTimeOfDayCacheBool.Store(mainKey, 1) return true } } - isInTimeOfDayCacheBool.Store(mainKey, false) + isInTimeOfDayCacheBool.Store(mainKey, 2) return false }