diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-05-12 17:01:54 +0900 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-05-12 17:05:20 +0900 |
commit | 05e00866312b177ff64fa6e5bcd565871a66d172 (patch) | |
tree | 0e78fb53cf0793a97ffaf659d2b87c56c0b4e32f | |
parent | d1839769ee37c779632f1581724864e957381c04 (diff) | |
download | subsurface-05e00866312b177ff64fa6e5bcd565871a66d172.tar.gz |
Don't use locale for git save format
I stupidly used "weekday()" without realizing we localize it. And we
really don't want to make save formats be localized (we don't localize
decimal numbers etc either).
This fixes the git save format to just use a hardcoded weekday list.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | save-git.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/save-git.c b/save-git.c index 169f5a1c6..3fd8807c6 100644 --- a/save-git.c +++ b/save-git.c @@ -447,10 +447,14 @@ static struct dir *new_directory(struct dir *parent, struct membuffer *namebuf) * time of the directory structure it is created in: the dive * might be part of a trip that straddles a month (or even a * year). + * + * We do *not* want to use localized weekdays and cause peoples save + * formats to depend on their locale. */ static void create_dive_name(struct dive *dive, struct membuffer *name, struct tm *dirtm) { struct tm tm; + static const char weekday[7][4] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; utc_mkdate(dive->when, &tm); if (tm.tm_year != dirtm->tm_year) @@ -459,7 +463,7 @@ static void create_dive_name(struct dive *dive, struct membuffer *name, struct t put_format(name, "%02u-", tm.tm_mon+1); put_format(name, "%02u-%s-%02u:%02u:%02u", - tm.tm_mday, weekday(tm.tm_wday), + tm.tm_mday, weekday[tm.tm_wday], tm.tm_hour, tm.tm_min, tm.tm_sec); } |