[evolution-data-server] Not able to select time in appointment/meeting for some locales
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Not able to select time in appointment/meeting for some locales
- Date: Fri, 10 Jul 2015 14:36:26 +0000 (UTC)
commit b4f62a416f3ed1b97400b7c378179bf0c37ba86f
Author: Milan Crha <mcrha redhat com>
Date: Fri Jul 10 16:33:10 2015 +0200
Not able to select time in appointment/meeting for some locales
The problem was that locale_supports_12_hour_format() returned failure
when the locale supported 12 hour format, because the AM/PM string
didn't fit the 16-bytes buffer. Using large-enough buffer and sane
'struct tm' values makes this work properly. One such locale is bn_IN.
libedataserver/e-time-utils.c | 21 ++++++++++++++++++++-
1 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/libedataserver/e-time-utils.c b/libedataserver/e-time-utils.c
index 058dadf..7bb7d75 100644
--- a/libedataserver/e-time-utils.c
+++ b/libedataserver/e-time-utils.c
@@ -1587,9 +1587,28 @@ static gboolean
locale_supports_12_hour_format (void)
{
struct tm tmp_tm = { 0 };
- gchar s[16];
+ gchar s[40];
+
+ /* Fill the struct tm with some sane values. */
+ tmp_tm.tm_year = 2000;
+ tmp_tm.tm_mon = 0;
+ tmp_tm.tm_mday = 1;
+ tmp_tm.tm_sec = 0;
+ tmp_tm.tm_isdst = 0;
+ tmp_tm.tm_hour = 1;
+ tmp_tm.tm_min = 0;
+ tmp_tm.tm_wday = 6;
+ tmp_tm.tm_yday = 6;
e_utf8_strftime (s, sizeof (s), "%p", &tmp_tm);
+
+ if (!s[0]) {
+ tmp_tm.tm_hour = 13;
+ tmp_tm.tm_min = 0;
+
+ e_utf8_strftime (s, sizeof (s), "%p", &tmp_tm);
+ }
+
return s[0] != '\0';
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]