summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-11-07 10:43:33 +0100
committerErich Eckner <git@eckner.net>2018-11-07 10:43:33 +0100
commit50d7954298e19d3c15584416862c5e273a5d02fa (patch)
treeffb23b4c12cab9391958ae9ea6b8d93f5153166e
parent68f3d76a5f48fb87f6c6e31980269444bad1069b (diff)
downloadanzeige-50d7954298e19d3c15584416862c5e273a5d02fa.tar.xz
anzeige.c: Wagonanzahl Wochentagsabhängig
-rw-r--r--anzeige.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/anzeige.c b/anzeige.c
index 5ac1fab..e271fff 100644
--- a/anzeige.c
+++ b/anzeige.c
@@ -110,7 +110,10 @@ int main(int argc, char **argv)
turn_off_display();
return EXIT_FAILURE;
}
- for (int i=0; i<5; i++) {
+ struct tm time_struct;
+ memset(&time_struct, 0, sizeof(time_struct));
+ localtime_r(&next_update, &time_struct);
+ for (int i = 0; i < (time_struct . tm_wday + 6) % 7 + 1; i++) {
if (text_buffer + TEXT_BUFFER_LENGTH - text_buffer_end <= 0)
break;
text_buffer_end += snprintf(text_buffer_end, text_buffer + TEXT_BUFFER_LENGTH - text_buffer_end, "%c%c%c%c", 0xEE, i==0 ? 0x01 : 0x03, 0xEE, i==0 ? 0x02 : 0x04);