package core

import "time"

// CronMatch returns true if time t matches all fields of the cron schedule.
func CronMatch(sched CronSchedule, t time.Time) bool {
	return intIn(t.Minute(), sched.Minute) &&
		intIn(t.Hour(), sched.Hour) &&
		intIn(t.Day(), sched.DayOfMonth) &&
		intIn(int(t.Month()), sched.Month) &&
		intIn(int(t.Weekday()), sched.DayOfWeek)
}
