diff options
| author | Maciej Borzecki <maciej.zenon.borzecki@canonical.com> | 2017-12-11 16:39:10 +0100 |
|---|---|---|
| committer | Maciej Borzecki <maciej.zenon.borzecki@canonical.com> | 2017-12-11 17:04:51 +0100 |
| commit | d60c0fb51b9d78e11a96c4c1a6b7ac1881669acb (patch) | |
| tree | 7b833ac1fa6b8c6061fcecc3dcd33552f12277e0 /timeutil | |
| parent | a325b649c6b4984e01bd43dcef6bb60590665a1c (diff) | |
timeutil: move comments inside if blocks they refer to
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
Diffstat (limited to 'timeutil')
| -rw-r--r-- | timeutil/schedule.go | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/timeutil/schedule.go b/timeutil/schedule.go index 78061673d0..3ded9c87df 100644 --- a/timeutil/schedule.go +++ b/timeutil/schedule.go @@ -136,8 +136,8 @@ func (ws WeekSpan) Match(t time.Time) bool { start, end := ws.Start, ws.End wdStart, wdEnd := start.Weekday, end.Weekday - // is it the right week? if start.Pos > 0 { + // is it the right week? week := uint(t.Day()/7) + 1 if start.Pos == 5 { @@ -312,8 +312,9 @@ func (sched *Schedule) Next(last time.Time) ScheduleWindow { var window ScheduleWindow - // if there's a week schedule, check if we hit that first if len(sched.WeekSpans) > 0 { + // if there's a week schedule, check if we hit that + // first var weekMatch bool for _, week := range sched.WeekSpans { if week.Match(t) { @@ -333,23 +334,26 @@ func (sched *Schedule) Next(last time.Time) ScheduleWindow { // 'now', and does not include the 'last' time newWindow := tspan.Window(t) - // the time span ends before 'now', try another one if newWindow.End.Before(now) { + // the time span ends before 'now', try another + // one continue } - // same interval as last update, move forward if newWindow.Includes(last) { + // same interval as last update, move forward continue } - // if this candidate comes before current candidate use it if window.IsZero() || newWindow.Start.Before(window.Start) { + // this candidate comes before current + // candidate, so use it window = newWindow } } - // no suitable time span was found this day so try the next day if window.End.Before(now) { + // no suitable time span was found this day so try the + // next day continue } return window |
