Skip to content
This repository was archived by the owner on Aug 18, 2020. It is now read-only.

Commit 32a53bd

Browse files
aentingermattiabertorello
authored andcommitted
Bugfix: Parsing BaseTime regardless if its a double or an int
1 parent 2ed497b commit 32a53bd

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/ArduinoCloudThing.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,12 +300,20 @@ ArduinoCloudThing::MapParserState ArduinoCloudThing::handle_BaseTime(CborValue *
300300
double val = 0.0;
301301
if(cbor_value_get_double(value_iter, &val) == CborNoError) {
302302
map_data->base_time.set(val);
303-
if(cbor_value_advance(value_iter) == CborNoError) {
304-
next_state = MapParserState::MapKey;
305-
}
306303
}
307304
}
308305

306+
if(cbor_value_is_integer(value_iter)) {
307+
int val = 0;
308+
if(cbor_value_get_int(value_iter, &val) == CborNoError) {
309+
map_data->base_time.set(static_cast<double>(val));
310+
}
311+
}
312+
313+
if(cbor_value_advance(value_iter) == CborNoError) {
314+
next_state = MapParserState::MapKey;
315+
}
316+
309317
return next_state;
310318
}
311319

0 commit comments

Comments
 (0)