Fix Bug#342546 by using the pref date format instead of locale.

Also prefix-pad fixed-width date formats with '0'.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@14158 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Chris Shoemaker 2006-05-24 00:49:10 +00:00
parent 38d01019bc
commit 998edefcc8
2 changed files with 14 additions and 5 deletions

View File

@ -456,10 +456,10 @@ qof_print_date_dmy_buff (char * buff, size_t len, int day, int month, int year)
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 @@ qof_print_date_dmy_buff (char * buff, size_t len, int day, int month, int year)
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 @@ gnc_iso8601_to_timespec_gmt(const char *str)
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 @@ gnc_iso8601_to_timespec_gmt(const char *str)
* 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);

View File

@ -1019,7 +1019,7 @@ gnc_plugin_page_budget_refresh_col_titles(GncPluginPageBudget *page)
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);