u 3 years ago
parent
commit
5f6204217e
  1. 22
      core.go

22
core.go

@ -117,32 +117,16 @@ func isInDayOfMonth(t time.Time, ta TimeArrow) bool {
return false
}
// var isInTimeOfDayCacheBool sync.Map
func isInTimeOfDay(t time.Time, ta TimeArrow) bool {
if len(ta.TimesOnDay) == 0 {
return true
}
tfdate := t.Format("2006-01-02 15:04:05")
var err error
// tmp, err := json.Marshal(ta.TimesOnDay)
// mainKey := fmt.Sprintf("[%s][%s]", tfdate, string(tmp))
// value, ok := isInTimeOfDayCacheBool.Load(mainKey)
// if ok && err == nil {
// ret := value.(int)
// if ret == 3 {
// // return true
// }
// if ret == 4 {
// return false
// }
// }
tfdate := t.Format("2006-01-02")
parseInLocationCache := map[string]time.Time{}
var err error
for k := range ta.TimesOnDay {
tsp := strings.Split(ta.TimesOnDay[k], "-")
if len(tsp) < 2 {
@ -197,11 +181,9 @@ func isInTimeOfDay(t time.Time, ta TimeArrow) bool {
}
if (t.After(startTime) || t.Equal(startTime)) && t.Before(endTime) {
// isInTimeOfDayCacheBool.Store(mainKey, 3)
return true
}
}
// isInTimeOfDayCacheBool.Store(mainKey, 4)
return false
}

Loading…
Cancel
Save