func (w *WindowedSchedule) setStopOnTime() {
	if w.StopTime == nil && w.Count != 0 {
		var newStop time.Time
		if w.StartTime != nil && time.Now().Before(*w.StartTime) {
			newStop = w.StartTime.Add(time.Duration(w.Count) * w.Interval)
		} else {
			newStop = time.Now().Add(time.Duration(w.Count) * w.Interval)
		}
		w.stopOnTime = &newStop
		return
	}
	w.stopOnTime = w.StopTime
}
setStopOnTime calculates and set the value of the windowed `stopOnTime` which is the right window boundary.
`stopOnTime` is determined by `StopTime` or, if it is not provided, calculated based on count and interval.
package schedule
import (
	"time"
	log "github.com/sirupsen/logrus"
)
var (
	logger = log.WithField("_module", "schedule")
)
type WindowedSchedule struct {
	Interval   time.Duration
	StartTime  *time.Time
	StopTime   *time.Time
	Count      uint
	state      ScheduleState
	stopOnTime *time.Time
}
func NewWindowedSchedule(i time.Duration, start *time.Time, stop *time.Time, count uint) *WindowedSchedule {
	if count != 0 && stop != nil {
		count = 0
		logger.WithFields(log.Fields{
			"_block": "NewWindowedSchedule",
		}).Warning("The window stop timestamp and the count cannot be specified simultaneously. The parameter `count` has been ignored.")
	}
	return &WindowedSchedule{
		Interval:  i,
		StartTime: start,
		StopTime:  stop,
		Count:     count,
	}
}