29 memset (tb->
clib_time, 0, sizeof (*clib_time));
106 u32 year, month, hours, minutes, seconds, nanoseconds;
107 u32 days_in_year, days_in_month, day_of_month;
108 u32 days_since_epoch;
114 days_since_epoch = 0;
119 days_since_epoch += days_in_year;
120 now =
now - ((
f64) days_in_year) * 86400.0;
125 days_since_epoch -= days_in_year;
126 now += ((
f64) days_in_year) * 86400;
137 days_since_epoch += days_in_month;
138 now =
now - ((
f64) days_in_month) * 86400.0;
143 days_since_epoch -= days_in_month;
144 now += ((
f64) days_in_month) * 86400;
160 day_name_index = days_since_epoch % 7;
162 hours = (
u32) (
now / (3600.0));
163 now -= (
f64) (hours * 3600);
165 minutes = (
u32) (
now / 60.0);
166 now -= (
f64) (minutes * 60);
171 nanoseconds = (
f64) (
now * 1e9);
175 cp->
day = day_of_month;
188 u32 year, days_in_year, month, days_in_month;
192 while (year < cp->year)
195 now += ((
f64) days_in_year) * 86400.0;
201 while (month < cp->month)
207 now += ((
f64) days_in_month) * 86400.0;
235 start_time -= 86400.0;
253 return ((
f64)
i) * 86400.0;
267 s =
format (s,
"%s, %u %s %u %u:%02u:%02u",
280 u32 start_hour, start_minute, start_second;
281 u32 end_hour, end_minute, end_second;
283 start_hour = start_minute = start_second
284 = end_hour = end_minute = end_second = 0;
286 if (
unformat (input,
"%u:%u:%u - %u:%u:%u",
287 &start_hour, &start_minute, &start_second,
288 &end_hour, &end_minute, &end_second))
290 else if (
unformat (input,
"%u:%u - %u:%u",
291 &start_hour, &start_minute, &end_hour, &end_minute))
293 else if (
unformat (input,
"%u - %u", &start_hour, &end_hour))
300 cp->
hour = start_hour;
301 cp->
minute = start_minute;
302 cp->
second = start_second;
321 int day_range_match = 0;
322 int time_range_match = 0;
323 f64 range_start_time_offset;
324 f64 range_end_time_offset;
326 u8 *start_day = 0, *end_day = 0;
333 &&
unformat (input,
"%s - %s", &start_day, &end_day))
335 range_start_time_offset
341 time_range_match = 0;
343 else if (!day_range_match &&
unformat (input,
"%s", &start_day))
345 range_start_time_offset
347 range_end_time_offset = range_start_time_offset + 86399.0;
351 time_range_match = 0;
353 else if (day_range_match &&
357 for (
now = range_start_time_offset;
now <= range_end_time_offset;
365 time_range_match = 1;
367 else if (time_range_match)
377 if (time_range_match)
394 f64 second_sunday_march_2am;
395 f64 first_sunday_november_2am;
437 second_sunday_march_2am += 86400.0;
445 second_sunday_march_2am += 86400.0;
449 second_sunday_march_2am -= 86400.0;
462 first_sunday_november_2am += 86400.0;