mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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:
parent
cfa0c9c735
commit
252761498a
1 changed files with 4 additions and 4 deletions
|
@ -16,7 +16,7 @@
|
||||||
+ ((p)[3]<<24))
|
+ ((p)[3]<<24))
|
||||||
|
|
||||||
struct lv_event {
|
struct lv_event {
|
||||||
time_t time;
|
uint32_t time;
|
||||||
struct pressure {
|
struct pressure {
|
||||||
int sensor;
|
int sensor;
|
||||||
int mbar;
|
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);
|
ps_ptr += handle_event_ver2(event_code, ps, ps_ptr, &event);
|
||||||
continue; // ignore all events
|
continue; // ignore all events
|
||||||
}
|
}
|
||||||
int sample_time, last_time;
|
uint32_t sample_time, last_time;
|
||||||
int depth_mm, last_depth, temp_mk, last_temp;
|
int depth_mm, last_depth, temp_mk, last_temp;
|
||||||
|
|
||||||
while (true) {
|
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_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
|
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)
|
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)
|
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);
|
finish_sample(dc);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue