g_date_time_format: support %T

strftime supports it, and there is no reason not to do the same.
This commit is contained in:
Matthias Clasen 2011-08-21 19:51:45 -04:00
parent fd1a12ca4d
commit 414c8ce532

View File

@ -53,6 +53,7 @@
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <langinfo.h>
#include "gdatetime.h"
@ -2222,6 +2223,11 @@ get_numeric_format (gchar *fmt,
* a tab character
* </simpara></listitem></varlistentry>
* <varlistentry><term>
* <literal>%%T</literal>:
* </term><listitem><simpara>
* the time in 24-hour notation with seconds (<literal>%%H:%%M:%%S</literal>)
* </simpara></listitem></varlistentry>
* <varlistentry><term>
* <literal>%%u</literal>:
* </term><listitem><simpara>
* the day of the week as a decimal, range 1 to 7, Monday being 1
@ -2457,6 +2463,12 @@ g_date_time_format (GDateTime *datetime,
case 't':
g_string_append_c (outstr, '\t');
break;
case 'T':
g_string_append_printf (outstr, "%02d:%02d:%02d",
g_date_time_get_hour (datetime),
g_date_time_get_minute (datetime),
g_date_time_get_second (datetime));
break;
case 'u':
get_numeric_format (fmt, sizeof(fmt), alt_digits, 0, 0);
g_string_append_printf (outstr, fmt, g_date_time_get_day_of_week (datetime));