recorder: Add support for %t in filename pattern

Similar to the %d format for the current date, the new %t format
can be used to use the current time in screencast filenames.

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

View File

@ -1228,6 +1228,21 @@ recorder_open_outfile (ShellRecorder *recorder)
g_date_time_unref (datetime);
}
break;
case 't':
{
/* Appends time according to locale */
GDateTime *datetime = g_date_time_new_now_local ();
char *time_str = g_date_time_format (datetime, "%0X");
char *s;
for (s = time_str; *s; s++)
if (G_IS_DIR_SEPARATOR (*s))
*s = ':';
g_string_append (filename, time_str);
g_free (time_str);
g_date_time_unref (datetime);
}
case 'u':
if (recorder->unique)
g_string_append (filename, recorder->unique);