]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
Support 390x format of nl_langinfo(FIRST_WEEKDAY) 662/head
authorJean-Michel Vourgère <nirgal@debian.org>
Thu, 13 Aug 2015 22:16:25 +0000 (00:16 +0200)
committerJean-Michel Vourgère <nirgal@debian.org>
Thu, 13 Aug 2015 22:16:25 +0000 (00:16 +0200)
nl_langinfo returns non-portable format for FIRST_WEEKDAY. See
https://www.gnu.org/software/libc/manual/html_node/The-Elegant-and-Fast-Way.html#The-Elegant-and-Fast-Way

That patch add support for the format used on 390x architecture.
This permits the unit tests to work there.

configure.ac
src/rrd_graph.c
src/rrd_rpncalc.c

index 5270b22910be7fae8bd105df9796a35c344b91c7..641dedbc3c0a55dfc640bff7a9a754e28ee46639 100644 (file)
@@ -526,6 +526,8 @@ AC_LANG_POP(C)
 dnl is time_t 32 of 64 bit ?
 AC_CHECK_SIZEOF([time_t])
 
+AC_CHECK_SIZEOF([long int])
+
 CONFIGURE_PART(Find 3rd-Party Libraries)
 
 have_libdbi=no
index ff21f32195dc77a975940ceba85667a387bc6ac2..d6ff8063ff13dfe8c0cf089eaee512bd1949121a 100644 (file)
@@ -1500,8 +1500,18 @@ static int find_first_weekday(void){
         first_weekday = nl_langinfo (_NL_TIME_FIRST_WEEKDAY)[0];
         int week_1stday;
         long week_1stday_l = (long) nl_langinfo (_NL_TIME_WEEK_1STDAY);
-        if (week_1stday_l == 19971130) week_1stday = 0; /* Sun */
-        else if (week_1stday_l == 19971201) week_1stday = 1; /* Mon */
+        if (week_1stday_l == 19971130
+#if SIZEOF_LONG_INT > 4
+            || week_1stday_l >> 32 == 19971130
+#endif
+           )
+            week_1stday = 0; /* Sun */
+        else if (week_1stday_l == 19971201
+#if SIZEOF_LONG_INT > 4
+           || week_1stday_l >> 32 == 19971201
+#endif
+           )
+            week_1stday = 1; /* Mon */
         else
         {
             first_weekday = 1;
index e57618ecb6f8352b10707417898b6b8be814401c..ad951bfbb8374aeda89fa5adde0227e80d20583e 100644 (file)
@@ -512,8 +512,18 @@ static int find_first_weekday(void){
         first_weekday = nl_langinfo (_NL_TIME_FIRST_WEEKDAY)[0];
         int week_1stday;
         long week_1stday_l = (long) nl_langinfo (_NL_TIME_WEEK_1STDAY);
-        if (week_1stday_l == 19971130) week_1stday = 0; /* Sun */
-        else if (week_1stday_l == 19971201) week_1stday = 1; /* Mon */
+        if (week_1stday_l == 19971130
+#if SIZEOF_LONG_INT > 4
+            || week_1stday_l >> 32 == 19971130
+#endif
+           )
+            week_1stday = 0; /* Sun */
+        else if (week_1stday_l == 19971201
+#if SIZEOF_LONG_INT > 4
+           || week_1stday_l >> 32 == 19971201
+#endif
+           )
+            week_1stday = 1; /* Mon */
         else
         {
             first_weekday = 1;