From 50d7954298e19d3c15584416862c5e273a5d02fa Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Wed, 7 Nov 2018 10:43:33 +0100 Subject: anzeige.c: Wagonanzahl Wochentagsabhängig MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- anzeige.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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); -- cgit v1.2.3-54-g00ecf