diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-09-11 11:36:33 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-09-11 11:36:33 -0700 |
commit | 6538e5bba00b51a7253b6cff927c8774f1b39e2b (patch) | |
tree | b6e322faaf26895c6b2ef2b8d399f1dabb78eebb /save-xml.c | |
parent | d1b30212ff7192ef1b3fa85924433a8ddd92c281 (diff) | |
download | subsurface-6538e5bba00b51a7253b6cff927c8774f1b39e2b.tar.gz |
Save and restore a "dive number"
Some people want to know how many dives they have under their belt, so
let's save and restore the dive number if it exists.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'save-xml.c')
-rw-r--r-- | save-xml.c | 11 |
1 files changed, 8 insertions, 3 deletions
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); |