datetime: Use %Z for the timezone name

We should try and follow strftime(3) for the format control characters
as much as possible.
This commit is contained in:
Emmanuele Bassi 2010-08-25 12:14:04 +01:00
parent b4c0b958af
commit 0a59ab6e85
2 changed files with 3 additions and 3 deletions

View File

@ -1809,7 +1809,7 @@ g_date_time_new_now (void)
* the date.
* %%y The year as a decimal number without the century.
* %%Y The year as a decimal number including the century.
* %%z The timezone or name or abbreviation.
* %%Z Alphabetic time zone abbreviation (e.g. EDT).
* %%% A literal %% character.
*
* Return value: a newly allocated string formatted to the requested format or
@ -1983,7 +1983,7 @@ g_date_time_printf (const GDateTime *datetime,
g_string_append_printf (outstr, "%d",
g_date_time_get_year (datetime));
break;
case 'z':
case 'Z':
if (datetime->tz)
g_string_append_printf (outstr, "%s", datetime->tz->name);
else

View File

@ -905,7 +905,7 @@ GDateTime *__dt = g_date_time_new_from_date (2009, 10, 24); \
TEST_PRINTF ("%%", "%");
TEST_PRINTF ("%", "");
TEST_PRINTF ("%9", NULL);
TEST_PRINTF ("%z", dst);
TEST_PRINTF ("%Z", dst);
}
gint