From 31569b751fa415efe7e85b287b8d208cb59abdc7 Mon Sep 17 00:00:00 2001 From: Dave Peticolas Date: Wed, 14 Feb 2001 22:11:30 +0000 Subject: [PATCH] Use nl_langinfo(D_FMT) instead of %x for locale-based date formatting. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3657 57a11ea4-9604-0410-9ed3-97b8803252fd --- ChangeLog | 5 +++++ src/engine/date.c | 9 +++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8c1d022dea..71aec88018 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2001-02-14 Dave Peticolas + + * src/engine/date.c: use nl_langinfo (D_FMT) instead of %x for + locale-based date formatting and parsing. + 2001-02-14 Bill Gribble * src/scm/qif-import/*.scm: fuzzify account type rules a bit to diff --git a/src/engine/date.c b/src/engine/date.c index 52f1331e72..f186d469c0 100644 --- a/src/engine/date.c +++ b/src/engine/date.c @@ -30,6 +30,7 @@ #include "config.h" #include +#include #include #include #include @@ -136,7 +137,7 @@ printDate (char * buff, int day, int month, int year) tm_str.tm_sec = 0; tm_str.tm_isdst = -1; - strftime (buff, MAX_DATE_LENGTH, "%x", &tm_str); + strftime (buff, MAX_DATE_LENGTH, nl_langinfo (D_FMT), &tm_str); } break; @@ -239,7 +240,7 @@ scanDate (const char *buff, int *day, int *month, int *year) { struct tm thetime; - strptime (buff, "%x", &thetime); + strptime (buff, nl_langinfo (D_FMT), &thetime); iday = thetime.tm_mday; imonth = thetime.tm_mon + 1; @@ -313,7 +314,7 @@ char dateSeparator () secs = time(NULL); tm = localtime(&secs); - strftime(string, sizeof(string), "%x", tm); + strftime(string, sizeof(string), nl_langinfo (D_FMT), tm); for (s = string; s != '\0'; s++) if (!isdigit(*s)) @@ -393,7 +394,7 @@ gnc_iso8601_to_timespec(const char *str, int do_localtime) /* adjust for the local timezone */ if (do_localtime) { - int tz_hour=0; + time_t tz_hour = 0; localtime (&tz_hour); /* bogus call, forces 'timezone' to be set */ tz_hour = timezone/3600; stm.tm_hour -= tz_hour;