u 3 years ago
parent
commit
7ad2f23f21
  1. 12
      core.go

12
core.go

@ -5,6 +5,7 @@ import (
"log" "log"
"sort" "sort"
"strings" "strings"
"sync"
"time" "time"
"github.com/google/uuid" "github.com/google/uuid"
@ -99,12 +100,21 @@ func isInWeekOfDay(t time.Time, ta TimeArrow) bool {
return false return false
} }
var timeCompletionCache sync.Map
func timeCompletion(a string) string { func timeCompletion(a string) string {
rets, ok := timeCompletionCache.Load(a)
if ok {
return rets.(string)
}
sc := strings.Split(a, ":") sc := strings.Split(a, ":")
for len(sc) < 3 { for len(sc) < 3 {
sc = append(sc, "00") sc = append(sc, "00")
} }
return strings.Join(sc, ":")
ret := strings.Join(sc, ":")
timeCompletionCache.Store(a, ret)
return ret
} }
func isInDayOfMonth(t time.Time, ta TimeArrow) bool { func isInDayOfMonth(t time.Time, ta TimeArrow) bool {

Loading…
Cancel
Save