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>
This commit is contained in:
Linus Torvalds 2014-05-12 17:01:54 +09:00 committed by Dirk Hohndel
parent d1839769ee
commit 05e0086631

View file

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