diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-09-01 17:17:19 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-09-01 17:17:19 -0700 |
commit | adc92d6de2ee1c71e88b66fb9c41e52de8cf4ea1 (patch) | |
tree | c402168b25578bdbb124246ffdef6b3d1d7fa20f /save-xml.c | |
parent | 5001ab66cba885411e9ee4e8c701688b4928ab1d (diff) | |
download | subsurface-adc92d6de2ee1c71e88b66fb9c41e52de8cf4ea1.tar.gz |
Always use proper units when saving.
When we see a number like 23.145, we'd better always also see a unit.
It's just good practice. So add 'min' to duration (and use only two
digits for number of seconds), and 'm' to depth.
And write the date in international standard format.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'save-xml.c')
-rw-r--r-- | save-xml.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/save-xml.c b/save-xml.c index 406469b14..f1049f0e8 100644 --- a/save-xml.c +++ b/save-xml.c @@ -31,7 +31,7 @@ static void show_depth(FILE *f, depth_t depth, const char *pre, const char *post static void show_duration(FILE *f, duration_t duration, const char *pre, const char *post) { if (duration.seconds) - fprintf(f, "%s%u:%03u%s", pre, FRACTION(duration.seconds, 60), post); + fprintf(f, "%s%u:%02u%s", pre, FRACTION(duration.seconds, 60), post); } static void show_pressure(FILE *f, pressure_t pressure, const char *pre, const char *post) @@ -72,7 +72,7 @@ static void save_gasmix(FILE *f, struct dive *dive) static void save_sample(FILE *f, struct sample *sample) { - fprintf(f, " <sample time='%u:%02u' depth='%u.%03u'", + fprintf(f, " <sample time='%u:%02u min' depth='%u.%03u m'", FRACTION(sample->time.seconds,60), FRACTION(sample->depth.mm, 1000)); show_temperature(f, sample->temperature, " temp='", " C'"); @@ -87,8 +87,8 @@ static void save_dive(FILE *f, struct dive *dive) int i; struct tm *tm = gmtime(&dive->when); - fprintf(f, "<dive date='%02u.%02u.%u' time='%02u:%02u:%02u'>\n", - tm->tm_mday, tm->tm_mon+1, tm->tm_year+1900, + fprintf(f, "<dive date='%04u-%02u-%02u' time='%02u:%02u:%02u'>\n", + tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec); save_overview(f, dive); save_gasmix(f, dive); |