From f446686916e503dfb9fb928252d1b72a07573b29 Mon Sep 17 00:00:00 2001
From: Dengke Du <dengke.du@windriver.com>
Date: Tue, 18 Jul 2017 03:42:56 -0400
Subject: [PATCH] remove glibc assumption

glibc time.h header has an undocumented __isleap macro
that we are using anf musl is missing it.
Since it is undocumented & does not appear
on any other libc, stop using it and just define the macro in
locally  instead.

Upstream-Status: Submitted [ https://lists.debian.org/debian-accessibility/2017/07/msg00044.html ]

Signed-off-by: Khem Raj <raj.khem@gmail.com>

Signed-off-by: Dengke Du <dengke.du@windriver.com>
---
 parsetime.y | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

Index: at-3.2.1/parsetime.y
===================================================================
--- at-3.2.1.orig/parsetime.y
+++ at-3.2.1/parsetime.y
@@ -14,6 +14,9 @@
     ((y) % 4 == 0 && ((y) % 100 != 0 || (y) % 400 == 0))
 #endif
 
+#define is_leap_year(y) \
+    ((y) % 4 == 0 && ((y) % 100 != 0 || (y) % 400 == 0))
+
 struct tm exectm;
 static int isgmt;
 static char *tz = NULL;
@@ -230,8 +233,8 @@ date            : month_name day_number
 				 mnum == 12) && dnum > 31)
 			    || ((mnum ==  4 || mnum ==  6 || mnum ==  9 ||
 			         mnum == 11) && dnum > 30)
-			    || (mnum ==  2 && dnum > 29 &&  __isleap(ynum+1900))
-			    || (mnum ==  2 && dnum > 28 && !__isleap(ynum+1900))
+			    || (mnum ==  2 && dnum > 29 &&  is_leap_year(ynum+1900))
+			    || (mnum ==  2 && dnum > 28 && !is_leap_year(ynum+1900))
 			   )
 			{
 			    yyerror("Error in day of month");
@@ -274,8 +277,8 @@ date            : month_name day_number
 				 mnum == 12) && dnum > 31)
 			    || ((mnum ==  4 || mnum ==  6 || mnum ==  9 ||
 			         mnum == 11) && dnum > 30)
-			    || (mnum ==  2 && dnum > 29 &&  __isleap(ynum+1900))
-			    || (mnum ==  2 && dnum > 28 && !__isleap(ynum+1900))
+			    || (mnum ==  2 && dnum > 29 &&  is_leap_year(ynum+1900))
+			    || (mnum ==  2 && dnum > 28 && !is_leap_year(ynum+1900))
 			   )
 			{
 			    yyerror("Error in day of month");
