recorder: Use locale-dependent format for %d in filename

Currently %d hardcodes a date format of YYYYMMDD, use the preferred
format for the current locale instead.

https://bugzilla.gnome.org/show_bug.cgi?id=670753
This commit is contained in:
Florian Müllner 2012-02-24 18:05:29 +01:00
parent e322d98886
commit 914441218a

View File

@ -1214,16 +1214,18 @@ recorder_open_outfile (ShellRecorder *recorder)
break; break;
case 'd': case 'd':
{ {
/* Appends date as YYYYMMDD */ /* Appends date according to locale */
GDate date; GDateTime *datetime = g_date_time_new_now_local ();
GTimeVal now; char *date_str = g_date_time_format (datetime, "%0x");
g_get_current_time (&now); char *s;
g_date_clear (&date, 1);
g_date_set_time_val (&date, &now); for (s = date_str; *s; s++)
g_string_append_printf (filename, "%04d%02d%02d", if (G_IS_DIR_SEPARATOR (*s))
g_date_get_year (&date), *s = '-';
g_date_get_month (&date),
g_date_get_day (&date)); g_string_append (filename, date_str);
g_free (date_str);
g_date_time_unref (datetime);
} }
break; break;
case 'u': case 'u':