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:
parent
e322d98886
commit
914441218a
@ -1214,16 +1214,18 @@ recorder_open_outfile (ShellRecorder *recorder)
|
||||
break;
|
||||
case 'd':
|
||||
{
|
||||
/* Appends date as YYYYMMDD */
|
||||
GDate date;
|
||||
GTimeVal now;
|
||||
g_get_current_time (&now);
|
||||
g_date_clear (&date, 1);
|
||||
g_date_set_time_val (&date, &now);
|
||||
g_string_append_printf (filename, "%04d%02d%02d",
|
||||
g_date_get_year (&date),
|
||||
g_date_get_month (&date),
|
||||
g_date_get_day (&date));
|
||||
/* Appends date according to locale */
|
||||
GDateTime *datetime = g_date_time_new_now_local ();
|
||||
char *date_str = g_date_time_format (datetime, "%0x");
|
||||
char *s;
|
||||
|
||||
for (s = date_str; *s; s++)
|
||||
if (G_IS_DIR_SEPARATOR (*s))
|
||||
*s = '-';
|
||||
|
||||
g_string_append (filename, date_str);
|
||||
g_free (date_str);
|
||||
g_date_time_unref (datetime);
|
||||
}
|
||||
break;
|
||||
case 'u':
|
||||
|
Loading…
Reference in New Issue
Block a user