You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For your normalize-schedule function to work properly, :hour must be explicitly specified in the schedule.
A general-purpose normalize-schedule might work like this:
Given a schedule, take the "largest" time unit explicitly specified in the schedule. For example, :day is the largest time unit in {:day [1 15] :hour 6}.
For any time unit that is "to the left of" the largest time unit in the schedule, we "fill in" all possible values. So, for :month we fill in [1..31]. For :year, we fill in, OK, some practical values like [2014..2114].
For any time unit that is "to the right of" the largest time unit in the schedule, we "fill in" the default values. So for :minute, we fill in 0. For :second, also 0.
For example, the normalized version of the the schedule {:day [1 15], :hour 6} is:
Hi Tim,
https://github.com/snh-clj/problem-solver/blob/master/rollover-time/src/snh_problems/rollover_time/tjm.clj#L4
For your
normalize-schedule
function to work properly,:hour
must be explicitly specified in the schedule.A general-purpose normalize-schedule might work like this:
:day
is the largest time unit in{:day [1 15] :hour 6}
.:month
we fill in[1..31]
. For:year
, we fill in, OK, some practical values like[2014..2114]
.:minute
, we fill in 0. For:second
, also 0.For example, the normalized version of the the schedule
{:day [1 15], :hour 6}
is:{:year [2014..2114] :month: [1..12] :day [1 15] :hour 6 :minute 0 :second 0}
I did write a function to normalize the schedule in the way described above. But once again, it was pretty ugly.
The text was updated successfully, but these errors were encountered: