Skip to content

Commit

Permalink
fix DTM type with recent dates (fixes john30#1172)
Browse files Browse the repository at this point in the history
  • Loading branch information
john30 committed Jan 27, 2024
1 parent 64b2b2e commit 64727a4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
3 changes: 2 additions & 1 deletion src/lib/ebus/datatype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/lib/ebus/test/test_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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", ""},
Expand Down

0 comments on commit 64727a4

Please sign in to comment.