diff --git a/subsys/net/lib/lwm2m/ipso_filling_sensor.c b/subsys/net/lib/lwm2m/ipso_filling_sensor.c index 478ab0c840d..d85e0d22209 100644 --- a/subsys/net/lib/lwm2m/ipso_filling_sensor.c +++ b/subsys/net/lib/lwm2m/ipso_filling_sensor.c @@ -48,8 +48,8 @@ static bool container_full[MAX_INSTANCE_COUNT]; static double low_threshold[MAX_INSTANCE_COUNT]; static bool container_empty[MAX_INSTANCE_COUNT]; static double average_fill_speed[MAX_INSTANCE_COUNT]; -static int64_t forecast_full_date[MAX_INSTANCE_COUNT]; -static int64_t forecast_empty_date[MAX_INSTANCE_COUNT]; +static time_t forecast_full_date[MAX_INSTANCE_COUNT]; +static time_t forecast_empty_date[MAX_INSTANCE_COUNT]; static bool container_out_of_location[MAX_INSTANCE_COUNT]; static bool container_out_of_position[MAX_INSTANCE_COUNT]; diff --git a/subsys/net/lib/lwm2m/lwm2m_obj_device.c b/subsys/net/lib/lwm2m/lwm2m_obj_device.c index 16cc7a8ff23..fdad85a7e71 100644 --- a/subsys/net/lib/lwm2m/lwm2m_obj_device.c +++ b/subsys/net/lib/lwm2m/lwm2m_obj_device.c @@ -90,8 +90,8 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME); /* resource state variables */ static uint8_t error_code_list[DEVICE_ERROR_CODE_MAX]; -static int32_t time_temp; -static uint32_t time_offset; +static time_t time_temp; +static time_t time_offset; static uint8_t binding_mode[DEVICE_STRING_SHORT]; /* only 1 instance of device object exists */ @@ -170,7 +170,10 @@ static int current_time_post_write_cb(uint16_t obj_inst_id, uint16_t res_id, bool last_block, size_t total_size) { if (data_len == 4U) { - time_offset = *(int32_t *)data - (int32_t)(k_uptime_get() / 1000); + time_offset = *(uint32_t *)data - (uint32_t)(k_uptime_get() / 1000); + return 0; + } else if (data_len == 8U) { + time_offset = *(time_t *)data - (time_t)(k_uptime_get() / 1000); return 0; } diff --git a/subsys/net/lib/lwm2m/lwm2m_obj_location.c b/subsys/net/lib/lwm2m/lwm2m_obj_location.c index 9ab5dacaafd..a7b06ba77b5 100644 --- a/subsys/net/lib/lwm2m/lwm2m_obj_location.c +++ b/subsys/net/lib/lwm2m/lwm2m_obj_location.c @@ -42,7 +42,7 @@ static double longitude; static double altitude; static double radius; static double speed; -static int32_t timestamp; +static time_t timestamp; static struct lwm2m_engine_obj location; static struct lwm2m_engine_obj_field fields[] = { diff --git a/tests/net/lib/lwm2m/content_senml_cbor/src/main.c b/tests/net/lib/lwm2m/content_senml_cbor/src/main.c index 17c7e981271..8fb4aa8b7ca 100644 --- a/tests/net/lib/lwm2m/content_senml_cbor/src/main.c +++ b/tests/net/lib/lwm2m/content_senml_cbor/src/main.c @@ -65,7 +65,7 @@ static double test_float; static bool test_bool; static struct lwm2m_objlnk test_objlnk; static uint8_t test_opaque[TEST_OPAQUE_MAX_SIZE]; -static int64_t test_time; +static time_t test_time; static struct lwm2m_engine_obj_inst *test_obj_create(uint16_t obj_inst_id) {