diff options
author | Lubomir I. Ivanov <neolit123@gmail.com> | 2011-11-07 07:33:49 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-11-07 08:50:06 -0800 |
commit | 97f09f3ea81548a3aac5ae839b1d1bc6211fe8ec (patch) | |
tree | 14fac35925bd768abba30f95b65b3e22d529fbbf /statistics.c | |
parent | 6fa702bcbd95d909bfe4d17a0039005caabab141 (diff) | |
download | subsurface-97f09f3ea81548a3aac5ae839b1d1bc6211fe8ec.tar.gz |
don't use strftime() due to locale issues
Make statistics.c use snprintf() with weekday(), monthname() instead of
strftime(). The mingw strftime() ends up having lots of problems at
least on Windows unless you set the locale just right, so just avoid the
problem by doing the simple function by hand. We already did that in
other places anyway.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'statistics.c')
-rw-r--r-- | statistics.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/statistics.c b/statistics.c index d71422043..ee3a5b220 100644 --- a/statistics.c +++ b/statistics.c @@ -125,10 +125,18 @@ void show_dive_stats(struct dive *dive) const char *unit; int idx, offset, gas_used; struct dive *prev_dive; + struct tm *tm; process_all_dives(dive, &prev_dive); - strftime(buf, 80, "%a, %b %d, %Y, %k:%M", gmtime(&dive->when)); + tm = gmtime(&dive->when); + snprintf(buf, sizeof(buf), + "%s, %s %d, %d %2d:%02d", + weekday(tm->tm_wday), + monthname(tm->tm_mon), + tm->tm_mday, tm->tm_year + 1900, + tm->tm_hour, tm->tm_min); + set_label(info_stat_w.date, buf); set_label(info_stat_w.dive_time, "%d min", (dive->duration.seconds + 30) / 60); if (prev_dive) |