static void test_schedule_valid(void) { crono_schedule cs; struct tm tm; time_t tt; init_schedule(&cs); tt = 1384351140; gmtime_r(&tt, &tm); { crono_schedule_set(&cs, &tm); is_schedule(&cs, 2013, 11, 13, 13, 59, 0); crono_schedule_next_valid(&cs); is_schedule(&cs, 2013, 11, 16, 8, 0, 0); ok(crono_schedule_snapped(&cs), "snapped"); } { crono_schedule_set(&cs, &tm); is_schedule(&cs, 2013, 11, 13, 13, 59, 0); crono_schedule_prev_valid(&cs); is_schedule(&cs, 2013, 11, 12, 18, 50, 0); ok(crono_schedule_snapped(&cs), "snapped"); } }
void make_up_schedule() { init_schedule(); for (unsigned int i = 0, j = pivot_phil; i < nphil / 2; ++i, j += 2) { schedule[j % nphil] = true; } pivot_phil = (pivot_phil + 1) % nphil; }
static void init() { init_session_window(); init_schedule(); wnd_schedule = window_create(); #ifndef PBL_COLOR window_set_fullscreen(wnd_schedule, true); #endif window_set_window_handlers(wnd_schedule, (WindowHandlers) { .load = main_window_load, .unload = main_window_unload, });
static void test_schedule_get(void) { crono_schedule cs; struct tm tm; init_schedule(&cs); cs.f[crono_SECOND].pos = 0; cs.f[crono_MINUTE].pos = 59; cs.f[crono_HOUR].pos = 13; cs.f[crono_DAY].pos = 13; cs.f[crono_MONTH].pos = 11; cs.f[crono_YEAR].pos = 2013; crono_schedule_get(&cs, &tm); time_t tt = _timegm(&tm); if (!is(tt, 1384351140, "time set")) diag("wanted 1384351140, got %ld", (long) tt); }