Fix gasmix for OTU calculation

With the fixed sematics of get_gasmix to return the new gasmix for
the time of a gas switch (added comments to make this clear), in the
OTU calculation we need the previous gasmix for the interval up to the
current time.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
This commit is contained in:
Robert C. Helling 2018-10-30 12:19:00 +01:00 committed by bstoeger
parent 7e4c8c387b
commit 62c57be1da
2 changed files with 3 additions and 1 deletions

View file

@ -4433,6 +4433,7 @@ int dive_has_gps_location(const struct dive *dive)
return dive_site_has_gps_location(dive->dive_site);
}
/* When evaluated at the time of a gasswitch, this returns the new gas */
struct gasmix get_gasmix(const struct dive *dive, const struct divecomputer *dc, int time, const struct event **evp, struct gasmix gasmix)
{
const struct event *ev = *evp;
@ -4456,6 +4457,7 @@ struct gasmix get_gasmix(const struct dive *dive, const struct divecomputer *dc,
}
/* get the gas at a certain time during the dive */
/* If there is a gasswitch at that time, it returns the new gasmix */
struct gasmix get_gasmix_at_time(const struct dive *d, const struct divecomputer *dc, duration_t time)
{
const struct event *ev = NULL;