mirror of
https://github.com/Gnucash/gnucash.git
synced 2026-09-03 20:53:02 -05:00
2001-05-29 Dave Peticolas <dave@krondo.com>
* src/engine/date.c: handle all uses of nl_langinfo. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@4332 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
@@ -1,3 +1,7 @@
|
|||||||
|
2001-05-29 Dave Peticolas <dave@krondo.com>
|
||||||
|
|
||||||
|
* src/engine/date.c: handle all uses of nl_langinfo.
|
||||||
|
|
||||||
2001-05-30 Robert Graham Merkel <rgmerk@mira.net>
|
2001-05-30 Robert Graham Merkel <rgmerk@mira.net>
|
||||||
|
|
||||||
* src/engine/date.c (printDate): Workaround for
|
* src/engine/date.c (printDate): Workaround for
|
||||||
|
|||||||
+13
-3
@@ -31,7 +31,11 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_LANGINFO_D_FMT
|
||||||
#include <langinfo.h>
|
#include <langinfo.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -44,6 +48,12 @@
|
|||||||
|
|
||||||
#define NANOS_PER_SECOND 1000000000
|
#define NANOS_PER_SECOND 1000000000
|
||||||
|
|
||||||
|
#ifdef HAVE_LANGINFO_D_FMT
|
||||||
|
# define GNC_D_FMT (nl_langinfo (D_FMT))
|
||||||
|
#else
|
||||||
|
# define GNC_D_FMT "%Y-%m-%d"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* This is now user configured through the gnome options system() */
|
/* This is now user configured through the gnome options system() */
|
||||||
static DateFormat dateFormat = DATE_FORMAT_US;
|
static DateFormat dateFormat = DATE_FORMAT_US;
|
||||||
|
|
||||||
@@ -228,7 +238,7 @@ printDate (char * buff, int day, int month, int year)
|
|||||||
tm_str.tm_sec = 0;
|
tm_str.tm_sec = 0;
|
||||||
tm_str.tm_isdst = -1;
|
tm_str.tm_isdst = -1;
|
||||||
|
|
||||||
strftime (buff, MAX_DATE_LENGTH, nl_langinfo (D_FMT), &tm_str);
|
strftime (buff, MAX_DATE_LENGTH, GNC_D_FMT, &tm_str);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -331,7 +341,7 @@ scanDate (const char *buff, int *day, int *month, int *year)
|
|||||||
{
|
{
|
||||||
struct tm thetime;
|
struct tm thetime;
|
||||||
|
|
||||||
strptime (buff, nl_langinfo (D_FMT), &thetime);
|
strptime (buff, GNC_D_FMT, &thetime);
|
||||||
|
|
||||||
iday = thetime.tm_mday;
|
iday = thetime.tm_mday;
|
||||||
imonth = thetime.tm_mon + 1;
|
imonth = thetime.tm_mon + 1;
|
||||||
@@ -405,7 +415,7 @@ char dateSeparator ()
|
|||||||
|
|
||||||
secs = time(NULL);
|
secs = time(NULL);
|
||||||
tm = localtime(&secs);
|
tm = localtime(&secs);
|
||||||
strftime(string, sizeof(string), nl_langinfo (D_FMT), tm);
|
strftime(string, sizeof(string), GNC_D_FMT, tm);
|
||||||
|
|
||||||
for (s = string; s != '\0'; s++)
|
for (s = string; s != '\0'; s++)
|
||||||
if (!isdigit(*s))
|
if (!isdigit(*s))
|
||||||
|
|||||||
Reference in New Issue
Block a user