summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dive.h1
-rw-r--r--parse-xml.c5
-rw-r--r--save-xml.c11
3 files changed, 13 insertions, 4 deletions
diff --git a/dive.h b/dive.h
index 6191b60b9..3b5e5abd7 100644
--- a/dive.h
+++ b/dive.h
@@ -128,6 +128,7 @@ struct sample {
#define MAX_CYLINDERS (8)
struct dive {
+ int nr;
time_t when;
char *location;
char *notes;
diff --git a/parse-xml.c b/parse-xml.c
index 4fd4dcfe6..a71ff235b 100644
--- a/parse-xml.c
+++ b/parse-xml.c
@@ -609,7 +609,8 @@ static void divinglog_place(char *place, void *_location)
static int divinglog_dive_match(struct dive *dive, const char *name, int len, char *buf)
{
- return MATCH(".divedate", divedate, &dive->when) ||
+ return MATCH(".id", get_index, &dive->nr) ||
+ MATCH(".divedate", divedate, &dive->when) ||
MATCH(".entrytime", divetime, &dive->when) ||
MATCH(".depth", depth, &dive->maxdepth) ||
MATCH(".tanksize", cylindersize, &dive->cylinder[0].type.size) ||
@@ -876,6 +877,8 @@ static void try_to_fill_dive(struct dive *dive, const char *name, char *buf)
break;
}
+ if (MATCH(".nr", get_index, &dive->nr))
+ return;
if (MATCH(".date", divedate, &dive->when))
return;
if (MATCH(".time", divetime, &dive->when))
diff --git a/save-xml.c b/save-xml.c
index c93a828cc..e47092ebc 100644
--- a/save-xml.c
+++ b/save-xml.c
@@ -205,9 +205,14 @@ static void save_dive(FILE *f, struct dive *dive)
int i;
struct tm *tm = gmtime(&dive->when);
- fprintf(f, "<dive date='%04u-%02u-%02u' time='%02u:%02u:%02u' duration='%u:%02u min'>\n",
- tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday,
- tm->tm_hour, tm->tm_min, tm->tm_sec,
+ fputs("<dive", f);
+ if (dive->nr)
+ fprintf(f, " nr='%d'", dive->nr);
+ fprintf(f, " date='%04u-%02u-%02u'",
+ tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday);
+ fprintf(f, " time='%02u:%02u:%02u'",
+ tm->tm_hour, tm->tm_min, tm->tm_sec);
+ fprintf(f, " duration='%u:%02u min'>\n",
FRACTION(dive->duration.seconds, 60));
save_overview(f, dive);
save_cylinder_info(f, dive);