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>
This commit is contained in:
Linus Torvalds 2011-09-11 11:36:33 -07:00
parent d1b30212ff
commit 6538e5bba0
3 changed files with 13 additions and 4 deletions

View file

@ -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);