liquivision: use uint32_t for event time

This is stored as uint32_t, so no reason to use the larger time_t.
It appears to be, after all, relative to the dive start.

Coverity was complaining about the down-conversion later in the code.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2022-08-20 17:20:18 +02:00 committed by Dirk Hohndel
parent cfa0c9c735
commit 252761498a

View file

@ -16,7 +16,7 @@
+ ((p)[3]<<24))
struct lv_event {
time_t time;
uint32_t time;
struct pressure {
int sensor;
int mbar;
@ -326,7 +326,7 @@ static void parse_dives(int log_version, const unsigned char *buf, unsigned int
ps_ptr += handle_event_ver2(event_code, ps, ps_ptr, &event);
continue; // ignore all events
}
int sample_time, last_time;
uint32_t sample_time, last_time;
int depth_mm, last_depth, temp_mk, last_temp;
while (true) {
@ -376,9 +376,9 @@ static void parse_dives(int log_version, const unsigned char *buf, unsigned int
last_depth = array_uint16_le(ds + (d - 1) * 2) * 10; // cm->mm
last_temp = C_to_mkelvin((float) array_uint16_le(ts + (d - 1) * 2) / 10); // dC->mK
sample->depth.mm = last_depth + (depth_mm - last_depth)
* ((int)event.time - last_time) / sample_interval;
* ((int)event.time - (int)last_time) / sample_interval;
sample->temperature.mkelvin = last_temp + (temp_mk - last_temp)
* ((int)event.time - last_time) / sample_interval;
* ((int)event.time - (int)last_time) / sample_interval;
}
finish_sample(dc);