Skip to content

Commit

Permalink
allow minutes only for clock input
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDvP committed Sep 18, 2024
1 parent 3fa18e2 commit aca2ae8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ std::string Helpers::data_to_hex(const uint8_t * data, const uint8_t length) {
}

char str[length * 3];
memset(str, 0, length * sizeof(char));
memset(str, 0, sizeof(str));

char buffer[4];
char * p = &str[0];
Expand Down Expand Up @@ -837,6 +837,8 @@ uint16_t Helpers::string2minutes(const std::string & str) {

if (state == 1 && tmp < 60) {
return res + tmp;
} else if (state == 0) { // without : it's only minutes
return tmp;
} else {
return 0; // Or if we were not, something is wrong in the given string
}
Expand Down

0 comments on commit aca2ae8

Please sign in to comment.