好的,所以我有以下代码:
if (!clock_is_24h_style()) {
if (current_time->tm_hour <= 3)
set_container_image(&time_format_image, RESOURCE_ID_NBC, GPoint(0, 0));
else if (current_time->tm_hour == 4 && current_time->tm_min <= 29)
set_container_image(&time_format_image, RESOURCE_ID_ETODAY, GPoint(0, 0));
else if (current_time->tm_hour == 4 && current_time->tm_min >= 30)
set_container_image(&time_format_image, RESOURCE_ID_9NEWSMORN, GPoint(0, 0));
else if (current_time->tm_hour == 5)
set_container_image(&time_format_image, RESOURCE_ID_9NEWSMORN, GPoint(0, 0));
else if (current_time->tm_hour == 6)
set_container_image(&time_format_image, RESOURCE_ID_9NEWSMORN, GPoint(0, 0));
else if (current_time->tm_hour == 12 && current_time->tm_min <= 29)
set_container_image(&time_format_image, RESOURCE_ID_IMAGE_PM_MODE, GPoint(0, 0));
else if (current_time->tm_hour == 12 && current_time->tm_min >= 30)
set_container_image(&time_format_image, RESOURCE_ID_NBC, GPoint(0, 0));
else if (current_time->tm_hour == 13 && current_time->tm_min <= 29)
set_container_image(&time_format_image, RESOURCE_ID_WTC, GPoint(0, 0));
else if (current_time->tm_hour == 13 && current_time->tm_min >= 30)
set_container_image(&time_format_image, RESOURCE_ID_BEARS, GPoint(0, 0));
else if (current_time->tm_hour == 14 && current_time->tm_min <= 29)
set_container_image(&time_format_image, RESOURCE_ID_WTC, GPoint(0, 0));
else if (current_time->tm_hour == 14 && current_time->tm_min >= 30)
set_container_image(&time_format_image, RESOURCE_ID_BEARS, GPoint(0, 0));
else if (current_time->tm_hour == 15)
set_container_image(&time_format_image, RESOURCE_ID_NBC, GPoint(0, 0));
else if (current_time->tm_hour == 16)
set_container_image(&time_format_image, RESOURCE_ID_9NEWS4, GPoint(0, 0));
else if (current_time->tm_hour == 17)
set_container_image(&time_format_image, RESOURCE_ID_9NEWS5, GPoint(0, 0));
else if (current_time->tm_hour == 18 && current_time->tm_min <= 29)
set_container_image(&time_format_image, RESOURCE_ID_9NEWS6, GPoint(0, 0));
else if (current_time->tm_hour == 18 && current_time->tm_min >= 30)
set_container_image(&time_format_image, RESOURCE_ID_NN, GPoint(0, 0));
else if (current_time->tm_hour == 19)
set_container_image(&time_format_image, RESOURCE_ID_NBC, GPoint(0, 0));
else if (current_time->tm_hour == 20)
set_container_image(&time_format_image, RESOURCE_ID_WTC, GPoint(0, 0));
else if (current_time->tm_hour == 21)
set_container_image(&time_format_image, RESOURCE_ID_BEARS, GPoint(0, 0));
else if (current_time->tm_hour == 22)
set_container_image(&time_format_image, RESOURCE_ID_NBC, GPoint(0, 0));
else if (current_time->tm_hour == 23 && current_time->tm_min <= 34)
set_container_image(&time_format_image, RESOURCE_ID_9NEWS10, GPoint(0, 0));
else if (current_time->tm_hour >= 23 && current_time->tm_min >= 35)
set_container_image(&time_format_image, RESOURCE_ID_NBC, GPoint(0, 0));
else {
layer_remove_from_parent(&time_format_image.layer.layer);
bmp_deinit_container(&time_format_image);
}
它使手表上的图像在特定时间发生变化,这很棒而且很棒。
但是,代码每天循环,并且每天都在制作,并且它仅在工作日(周一至周五)准确,并且想知道如何制作它以便代码仅适用于周一至周五,而单独的代码将适用到星期六和另一个星期天。谢谢!