From 4abf00bca5884706b2b1e2f92b2d0a6a82b3225d Mon Sep 17 00:00:00 2001 From: Benjamin Vernoux Date: Sat, 3 Aug 2024 16:16:10 +0200 Subject: [PATCH] Update main.cpp Fix macro DAY for case is less 10 (with space instead of expected '0' character) --- Software/LibreCAL/src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Software/LibreCAL/src/main.cpp b/Software/LibreCAL/src/main.cpp index e92173b..cb8d702 100644 --- a/Software/LibreCAL/src/main.cpp +++ b/Software/LibreCAL/src/main.cpp @@ -35,7 +35,7 @@ const char* time = __TIME__; : date[2] == 't' ? 10 \ : date[2] == 'v' ? 11 : 12) -#define DAY(date) ((date[4] - '0') * 10 + (date[5] - '0')) +#define DAY(date) ((date[4] == ' ' ? 0 : (date[4] - '0') * 10) + (date[5] - '0')) #define HOUR(time) ((time[0] - '0') * 10 + (time[1] - '0')) #define MINUTE(time) ((time[3] - '0') * 10 + (time[4] - '0')) #define SECOND(time) ((time[6] - '0') * 10 + (time[7] - '0'))