You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.9 KiB

  1. From 7f811d9c4ebc9444e613e251c31d6bf537a24dc1 Mon Sep 17 00:00:00 2001
  2. From: Khem Raj <raj.khem@gmail.com>
  3. Date: Mon, 13 Apr 2015 16:35:30 -0700
  4. Subject: [PATCH] remove glibc assumption
  5. glibc time.h header has an undocumented __isleap macro
  6. that we are using anf musl is missing it.
  7. Since it is undocumented & does not appear
  8. on any other libc, stop using it and just define the macro in
  9. locally instead.
  10. Upstream-Status: Pending
  11. Signed-off-by: Khem Raj <raj.khem@gmail.com>
  12. [patch from: http://patchwork.openembedded.org/patch/91893/ ]
  13. Signed-off-by: Phil Eichinger <phil@zankapfel.net>
  14. ---
  15. parsetime.y | 11 +++++++----
  16. 1 file changed, 7 insertions(+), 4 deletions(-)
  17. diff --git a/parsetime.y b/parsetime.y
  18. index 7005e88..324e6d3 100644
  19. --- a/parsetime.y
  20. +++ b/parsetime.y
  21. @@ -8,6 +8,9 @@
  22. #define YYDEBUG 1
  23. +#define is_leap_year(y) \
  24. + ((y) % 4 == 0 && ((y) % 100 != 0 || (y) % 400 == 0))
  25. +
  26. struct tm exectm;
  27. static int isgmt;
  28. static int yearspec;
  29. @@ -217,8 +220,8 @@ date : month_name day_number
  30. mnum == 12) && dnum > 31)
  31. || ((mnum == 4 || mnum == 6 || mnum == 9 ||
  32. mnum == 11) && dnum > 30)
  33. - || (mnum == 2 && dnum > 29 && __isleap(ynum+1900))
  34. - || (mnum == 2 && dnum > 28 && !__isleap(ynum+1900))
  35. + || (mnum == 2 && dnum > 29 && is_leap_year(ynum+1900))
  36. + || (mnum == 2 && dnum > 28 && !is_leap_year(ynum+1900))
  37. )
  38. {
  39. yyerror("Error in day of month");
  40. @@ -261,8 +264,8 @@ date : month_name day_number
  41. mnum == 12) && dnum > 31)
  42. || ((mnum == 4 || mnum == 6 || mnum == 9 ||
  43. mnum == 11) && dnum > 30)
  44. - || (mnum == 2 && dnum > 29 && __isleap(ynum+1900))
  45. - || (mnum == 2 && dnum > 28 && !__isleap(ynum+1900))
  46. + || (mnum == 2 && dnum > 29 && is_leap_year(ynum+1900))
  47. + || (mnum == 2 && dnum > 28 && !is_leap_year(ynum+1900))
  48. )
  49. {
  50. yyerror("Error in day of month");
  51. --
  52. 2.1.4