func (c *CronSchedule) Wait(last time.Time) Response {
	var err error
	now := time.Now()
	if (last == time.Time{}) {
		last = now
	}
	if !c.enabled {
		err = c.schedule.AddFunc(c.entry, func() {})
		if err != nil {
			c.state = Error
		} else {
			c.enabled = true
		}
	}
	var misses uint
	if c.enabled {
		s := c.schedule.Entries()[0].Schedule
		for next := last; next.Before(now); {
			next = s.Next(next)
			if next.After(now) {
				break
			}
			misses++
		}
		waitTime := s.Next(now)
		time.Sleep(waitTime.Sub(now))
	}
	return &CronScheduleResponse{
		state:    c.GetState(),
		err:      err,
		missed:   misses,
		lastTime: time.Now(),
	}
}
Wait waits as long as specified in cron entry
package schedule
import (
	"errors"
	"time"
	"github.com/robfig/cron"
)
var ErrMissingCronEntry = errors.New("Cron entry is missing")
type CronSchedule struct {
	entry    string
	enabled  bool
	state    ScheduleState
	schedule *cron.Cron
}
func NewCronSchedule(entry string) *CronSchedule {
	schedule := cron.New()
	return &CronSchedule{
		entry:    entry,
		schedule: schedule,
		enabled:  false,
	}
}
func (c *CronSchedule) Entry() string {
	return c.entry
}
func (c *CronSchedule) GetState() ScheduleState {
	return c.state
}
func (c *CronSchedule) Validate() error {
	if c.entry == "" {
		return ErrMissingCronEntry
	}
	_, err := cron.Parse(c.entry)
	if err != nil {
		return err
	}
	return nil
}