summaryrefslogtreecommitdiff
path: root/src/utils.c
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2012-04-21 12:44:11 +0200
committerLukas Fleischer <calcurse@cryptocrack.de>2012-05-19 14:32:43 +0200
commitb4cefe2db9d45dfba9bfd633288a406a8ad2a4c3 (patch)
treefc53a5ffffed8b9599db9b28ba3e3ec18f404b86 /src/utils.c
parent162b871682946169871db3622e156ef641c44bf2 (diff)
downloadcalcurse-b4cefe2db9d45dfba9bfd633288a406a8ad2a4c3.zip
Do not localize dates in pcal exports
* Do not localize the word "week" in pcal export headers. * Reset current locale before formatting dates in pcal export data. Addresses BUG#1. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
Diffstat (limited to 'src/utils.c')
-rw-r--r--src/utils.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/utils.c b/src/utils.c
index b165111..0a01c2e 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -488,8 +488,15 @@ date_sec2date_str (long sec, char *datefmt)
void
date_sec2date_fmt (long sec, const char *fmt, char *datef)
{
+ /* TODO: Find a better way to deal with localization and strftime(). */
+ char *locale_old = mem_strdup (setlocale (LC_ALL, NULL));
+ setlocale (LC_ALL, "C");
+
struct tm *lt = localtime ((time_t *)&sec);
strftime (datef, BUFSIZ, fmt, lt);
+
+ setlocale (LC_ALL, locale_old);
+ mem_free (locale_old);
}
/*