fix DTM type with recent dates (fixes #1172)

This commit is contained in:
John
2024-01-27 10:11:42 +01:00
parent 64b2b2ea01
commit 64727a4a83
3 changed files with 6 additions and 2 deletions
+2
View File
@@ -1,6 +1,8 @@
# next (tbd)
## Bug Fixes
* fix conditional messages not being sent to message definition in MQTT integration and not being used in KNX group association
* fix CSV dump of config files on command line
* fix DTM type with recent dates
## Features
* add "inject" command
+2 -1
View File
@@ -591,7 +591,8 @@ result_t DateTimeDataType::writeSymbols(size_t offset, size_t length, istringstr
if (result != RESULT_OK) {
return result; // invalid time part
}
if ((i == 0 && value > 24) || (i > 0 && (last == 24 && value > 0) )) {
if ((i == (m_hasDate ? 2 : 0) && value > 24)
|| (i > (m_hasDate ? 2 : 0) && (last == 24 && value > 0) )) {
return RESULT_ERR_OUT_OF_RANGE; // invalid time part
}
if (hasFlag(SPE)) { // minutes since midnight
+2 -1
View File
@@ -174,7 +174,8 @@ int main() {
{"x,,day", "", "10fe0700020000", "00", "Rw"},
{"x,,dtm", "01.01.2009 00:00", "10fe07000400000000", "00", ""},
{"x,,dtm", "31.12.2099 23:59", "10fe0700041f4eda02", "00", ""},
{"x,,dtm", "16.12.2020 16:51", "10fe07000453f85f00", "00", ""},
{"x,,dtm", "16.12.2024 16:51", "10fe07000473128000", "00", ""},
{"x,,dtm", "24.12.2025 16:51", "10fe07000493448800", "00", ""},
{"x,,bti", "21:04:58", "10fe070003580421", "00", ""},
{"x,,bti", "00:00:00", "10fe070003000000", "00", ""},
{"x,,bti", "23:59:59", "10fe070003595923", "00", ""},