[Gnucash-changes] r14158 - gnucash/trunk - Fix Bug#342546 by using
the pref date format instead of locale.
Chris Shoemaker
chris at cvs.gnucash.org
Tue May 23 20:49:13 EDT 2006
Author: chris
Date: 2006-05-23 20:49:10 -0400 (Tue, 23 May 2006)
New Revision: 14158
Trac: http://svn.gnucash.org/trac/changeset/14158
Modified:
gnucash/trunk/lib/libqof/qof/gnc-date.c
gnucash/trunk/src/gnome/gnc-plugin-page-budget.c
Log:
Fix Bug#342546 by using the pref date format instead of locale.
Also prefix-pad fixed-width date formats with '0'.
Modified: gnucash/trunk/lib/libqof/qof/gnc-date.c
===================================================================
--- gnucash/trunk/lib/libqof/qof/gnc-date.c 2006-05-23 14:41:00 UTC (rev 14157)
+++ gnucash/trunk/lib/libqof/qof/gnc-date.c 2006-05-24 00:49:10 UTC (rev 14158)
@@ -456,10 +456,10 @@
switch(dateFormat)
{
case QOF_DATE_FORMAT_UK:
- flen = g_snprintf (buff, len, "%2d/%2d/%-4d", day, month, year);
+ flen = g_snprintf (buff, len, "%02d/%02d/%-4d", day, month, year);
break;
case QOF_DATE_FORMAT_CE:
- flen = g_snprintf (buff, len, "%2d.%2d.%-4d", day, month, year);
+ flen = g_snprintf (buff, len, "%02d.%02d.%-4d", day, month, year);
break;
case QOF_DATE_FORMAT_LOCALE:
{
@@ -485,7 +485,7 @@
break;
case QOF_DATE_FORMAT_US:
default:
- flen = g_snprintf (buff, len, "%2d/%2d/%-4d", month, day, year);
+ flen = g_snprintf (buff, len, "%02d/%02d/%-4d", month, day, year);
break;
}
@@ -1108,6 +1108,15 @@
tmp_tm.tm_hour -= 2;
secs = mktime (&tmp_tm);
}
+ /* CAS: Even correct implementations of mktime can return
+ (time_t)(-1): From the libc info page: "If the specified
+ broken-down time cannot be represented as a simple time,
+ `mktime' returns a value of `(time_t)(-1)' and does not modify
+ the contents of BROKENTIME." This happens for dates after 2038
+ when time_t is 32 bits. In those cases, this code above is
+ just noisy and has a slight risk of returning the incorrect
+ time.
+ */
if (secs < 0)
{
/* Seriously buggy mktime - give up. */
@@ -1122,7 +1131,7 @@
* value of 'gnc_timezone' includes daylight savings corrections
* for that date. */
- tm = *localtime_r (&secs, &tm);
+ localtime_r (&secs, &tm);
tz = gnc_timezone (&tmp_tm);
Modified: gnucash/trunk/src/gnome/gnc-plugin-page-budget.c
===================================================================
--- gnucash/trunk/src/gnome/gnc-plugin-page-budget.c 2006-05-23 14:41:00 UTC (rev 14157)
+++ gnucash/trunk/src/gnome/gnc-plugin-page-budget.c 2006-05-24 00:49:10 UTC (rev 14158)
@@ -1019,7 +1019,7 @@
date = r->start;
for (i = 0; i < num_periods_visible; i++) {
col = GTK_TREE_VIEW_COLUMN(g_list_nth_data(col_list, i));
- titlelen = g_date_strftime(title, MAX_DATE_LENGTH, "%x", &date);
+ titlelen = qof_print_gdate(title, MAX_DATE_LENGTH, &date);
if (titlelen > 0)
gtk_tree_view_column_set_title(col, title);
recurrenceNextInstance(r, &date, &nextdate);
More information about the gnucash-changes
mailing list