|
|
@ -154,6 +154,10 @@ func isInTimeOfDay(t time.Time, ta TimeArrow) bool { |
|
|
|
continue |
|
|
|
} |
|
|
|
start, end := tsp[0], tsp[1] |
|
|
|
if end == "24" || end == "24:00" || end == "24:00:00" { |
|
|
|
end = "23:59:59" |
|
|
|
} |
|
|
|
|
|
|
|
start = timeCompletion(start) |
|
|
|
end = timeCompletion(end) |
|
|
|
fmt.Println("ssee", start, end, tfdate) |
|
|
@ -171,15 +175,16 @@ func isInTimeOfDay2(t time.Time, ta TimeArrow) bool { |
|
|
|
return true |
|
|
|
} |
|
|
|
|
|
|
|
t, _ = time.ParseInLocation("2006-01-02 15:04:05", "2011-01-01 "+t.Format("15:04:05"), time.Local) |
|
|
|
// t, _ = time.ParseInLocation("2006-01-02 15:04:05", "2011-01-01 "+t.Format("15:04:05"), time.Local)
|
|
|
|
|
|
|
|
tfdate := t.Format("2006-01-02") |
|
|
|
|
|
|
|
cacheKey := fmt.Sprint(t.Format("15:04:05"), strings.Join(ta.TimesOnDay, "|")) |
|
|
|
ret, ok := inTimeOfDayCache.Load(cacheKey) |
|
|
|
if ok { |
|
|
|
return ret.(bool) |
|
|
|
} |
|
|
|
// cacheKey := fmt.Sprint(t.Format("15:04:05"), strings.Join(ta.TimesOnDay, "|"))
|
|
|
|
|
|
|
|
// ret, ok := inTimeOfDayCache.Load(cacheKey)
|
|
|
|
// if ok {
|
|
|
|
// return ret.(bool)
|
|
|
|
// }
|
|
|
|
|
|
|
|
// var err error
|
|
|
|
for k := range ta.TimesOnDay { |
|
|
@ -222,11 +227,11 @@ func isInTimeOfDay2(t time.Time, ta TimeArrow) bool { |
|
|
|
} |
|
|
|
|
|
|
|
if (t.After(startTime) || t.Equal(startTime)) && t.Before(endTime) { |
|
|
|
inTimeOfDayCache.Store(cacheKey, true) |
|
|
|
// inTimeOfDayCache.Store(cacheKey, true)
|
|
|
|
return true |
|
|
|
} |
|
|
|
} |
|
|
|
inTimeOfDayCache.Store(cacheKey, false) |
|
|
|
// inTimeOfDayCache.Store(cacheKey, false)
|
|
|
|
return false |
|
|
|
} |
|
|
|
|
|
|
|