From 414c8ce532c19fe65deb8dfb80222d0164be5cbe Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 21 Aug 2011 19:51:45 -0400 Subject: [PATCH] g_date_time_format: support %T strftime supports it, and there is no reason not to do the same. --- glib/gdatetime.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/glib/gdatetime.c b/glib/gdatetime.c index 32e280f85..cd44ef202 100644 --- a/glib/gdatetime.c +++ b/glib/gdatetime.c @@ -53,6 +53,7 @@ #ifdef HAVE_UNISTD_H #include #endif +#include #include "gdatetime.h" @@ -2222,6 +2223,11 @@ get_numeric_format (gchar *fmt, * a tab character * * + * %%T: + * + * the time in 24-hour notation with seconds (%%H:%%M:%%S) + * + * * %%u: * * 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));