diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/dive.h | 2 | ||||
-rw-r--r-- | core/load-git.c | 5 | ||||
-rw-r--r-- | core/parse-xml.c | 2 | ||||
-rw-r--r-- | core/planner.c | 5 | ||||
-rw-r--r-- | core/save-git.c | 2 | ||||
-rw-r--r-- | core/save-xml.c | 2 |
6 files changed, 15 insertions, 3 deletions
diff --git a/core/dive.h b/core/dive.h index 294620df7..3532b4a59 100644 --- a/core/dive.h +++ b/core/dive.h @@ -295,7 +295,7 @@ struct extra_data { */ struct divecomputer { timestamp_t when; - duration_t duration, surfacetime; + duration_t duration, surfacetime, last_manual_time; depth_t maxdepth, meandepth; temperature_t airtemp, watertemp; pressure_t surface_pressure; diff --git a/core/load-git.c b/core/load-git.c index dd8cb3eac..ef28498f2 100644 --- a/core/load-git.c +++ b/core/load-git.c @@ -692,6 +692,9 @@ static void parse_dc_duration(char *line, struct membuffer *str, void *_dc) static void parse_dc_dctype(char *line, struct membuffer *str, void *_dc) { (void) str; struct divecomputer *dc = _dc; dc->divemode = get_dctype(line); } +static void parse_dc_lastmanualtime(char *line, struct membuffer *str, void *_dc) +{ (void) str; struct divecomputer *dc = _dc; dc->last_manual_time = get_duration(line); } + static void parse_dc_maxdepth(char *line, struct membuffer *str, void *_dc) { (void) str; struct divecomputer *dc = _dc; dc->maxdepth = get_depth(line); } @@ -979,7 +982,7 @@ struct keyword_action dc_action[] = { #undef D #define D(x) { #x, parse_dc_ ## x } D(airtemp), D(date), D(dctype), D(deviceid), D(diveid), D(duration), - D(event), D(keyvalue), D(maxdepth), D(meandepth), D(model), D(numberofoxygensensors), + D(event), D(keyvalue), D(lastmanualtime), D(maxdepth), D(meandepth), D(model), D(numberofoxygensensors), D(salinity), D(surfacepressure), D(surfacetime), D(time), D(watertemp) }; diff --git a/core/parse-xml.c b/core/parse-xml.c index b31eef90b..d211921de 100644 --- a/core/parse-xml.c +++ b/core/parse-xml.c @@ -734,6 +734,8 @@ static int match_dc_data_fields(struct divecomputer *dc, const char *name, char return 1; if (MATCH("divetimesec", duration, &dc->duration)) return 1; + if (MATCH("last-manual-time", duration, &dc->last_manual_time)) + return 1; if (MATCH("surfacetime", duration, &dc->surfacetime)) return 1; if (MATCH("airtemp", temperature, &dc->airtemp)) diff --git a/core/planner.c b/core/planner.c index 2c5ad3d95..6b9b075ea 100644 --- a/core/planner.c +++ b/core/planner.c @@ -259,7 +259,7 @@ static void create_dive_from_plan(struct diveplan *diveplan, struct dive *dive, struct event *ev; cylinder_t *cyl; int oldpo2 = 0; - int lasttime = 0; + int lasttime = 0, last_manual_point = 0; depth_t lastdepth = {.mm = 0}; int lastcylid; enum dive_comp_type type = dive->dc.divemode; @@ -342,6 +342,7 @@ static void create_dive_from_plan(struct diveplan *diveplan, struct dive *dive, sample[-1].setpoint.mbar = po2; sample->setpoint.mbar = po2; sample->time.seconds = lasttime = time; + if (dp->entered) last_manual_point = dp->time; sample->depth = lastdepth = depth; sample->manually_entered = dp->entered; sample->sac.mliter = dp->entered ? prefs.bottomsac : prefs.decosac; @@ -354,6 +355,8 @@ static void create_dive_from_plan(struct diveplan *diveplan, struct dive *dive, finish_sample(dc); dp = dp->next; } + dive->dc.last_manual_time.seconds = last_manual_point; + dc->divemode = type; #if DEBUG_PLAN & 32 save_dive(stdout, &displayed_dive); diff --git a/core/save-git.c b/core/save-git.c index c8c9f06a4..d09513e1d 100644 --- a/core/save-git.c +++ b/core/save-git.c @@ -395,6 +395,8 @@ static void save_events(struct membuffer *b, struct dive *dive, struct event *ev static void save_dc(struct membuffer *b, struct dive *dive, struct divecomputer *dc) { show_utf8(b, "model ", dc->model, "\n"); + if (dc->last_manual_time.seconds) + put_duration(b, dc->last_manual_time, "lastmanualtime ", "min\n"); if (dc->deviceid) put_format(b, "deviceid %08x\n", dc->deviceid); if (dc->diveid) diff --git a/core/save-xml.c b/core/save-xml.c index 24bf3d64c..0fdd4df79 100644 --- a/core/save-xml.c +++ b/core/save-xml.c @@ -387,6 +387,8 @@ static void save_dc(struct membuffer *b, struct dive *dive, struct divecomputer { put_format(b, " <divecomputer"); show_utf8(b, dc->model, " model='", "'", 1); + if (dc->last_manual_time.seconds) + put_duration(b, dc->last_manual_time, " last-manual-time='", " min'"); if (dc->deviceid) put_format(b, " deviceid='%08x'", dc->deviceid); if (dc->diveid) |