[gtk: 1/2] calendar: Use the new "%OB" format in strftime()
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk: 1/2] calendar: Use the new "%OB" format in strftime()
- Date: Thu, 15 Feb 2018 03:08:50 +0000 (UTC)
commit b9ea25c25c031d2aca64662eaaa7251ac84c78e1
Author: Rafal Luzynski <digitalfreak lingonborough com>
Date: Sat Feb 10 14:07:56 2018 +0100
calendar: Use the new "%OB" format in strftime()
Due to the recent changes introduced in glibc 2.27 "%OB" is the
correct format to obtain a month name as used in the calendar
header. The same rule has been working in BSD family (including
OS X) since 1990s. This change is simple but makes GTK+ 4.x require
glibc >= 2.27. If this requirement cannot be fulfilled then we must
cherry-pick the full commit cbf118c from gtk-3-22 branch.
Closes: #9
gtk/gtkcalendar.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c
index 5bbb6cac19..a93d92e384 100644
--- a/gtk/gtkcalendar.c
+++ b/gtk/gtkcalendar.c
@@ -687,7 +687,7 @@ gtk_calendar_init (GtkCalendar *calendar)
{
#ifndef G_OS_WIN32
tmp_time= (i+3)*86400;
- strftime ( buffer, sizeof (buffer), "%a", gmtime (&tmp_time));
+ strftime (buffer, sizeof (buffer), "%a", gmtime (&tmp_time));
default_abbreviated_dayname[i] = g_locale_to_utf8 (buffer, -1, NULL, NULL, NULL);
#else
if (!GetLocaleInfoW (GetThreadLocale (), LOCALE_SABBREVDAYNAME1 + (i+6)%7,
@@ -703,7 +703,8 @@ gtk_calendar_init (GtkCalendar *calendar)
{
#ifndef G_OS_WIN32
tmp_time=i*2764800;
- strftime ( buffer, sizeof (buffer), "%B", gmtime (&tmp_time));
+ /* Note: "%OB" works only in glibc >= 2.27 and in BSD and OS X. */
+ strftime (buffer, sizeof (buffer), "%OB", gmtime (&tmp_time));
default_monthname[i] = g_locale_to_utf8 (buffer, -1, NULL, NULL, NULL);
#else
if (!GetLocaleInfoW (GetThreadLocale (), LOCALE_SMONTHNAME1 + i,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]