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.

79 lines
4.0 KiB

  1. From 01d0b036179e12284880fb2d29ae579399e5fe91 Mon Sep 17 00:00:00 2001
  2. From: Rosen Penev <rosenp@gmail.com>
  3. Date: Fri, 25 Oct 2019 15:05:14 -0700
  4. Subject: [PATCH] SunRiseSet: Use round instead of std::round.
  5. The latter is not available with uClibc-ng.
  6. Signed-off-by: Rosen Penev <rosenp@gmail.com>
  7. ---
  8. main/SunRiseSet.cpp | 20 ++++++++++----------
  9. 1 file changed, 10 insertions(+), 10 deletions(-)
  10. diff --git a/main/SunRiseSet.cpp b/main/SunRiseSet.cpp
  11. index 14fe07fee7..dce69bc7ba 100644
  12. --- a/main/SunRiseSet.cpp
  13. +++ b/main/SunRiseSet.cpp
  14. @@ -144,7 +144,7 @@ bool SunRiseSet::GetSunRiseSet(const double latit, const double longit, const in
  15. //astrlen = day_astronomical_twilight_length(year,month,day,longit,latit);
  16. double _tmpH;
  17. - result.DaylengthMins = static_cast<int>(std::round(modf(daylen, &_tmpH)*60));
  18. + result.DaylengthMins = static_cast<int>(round(modf(daylen, &_tmpH)*60));
  19. result.DaylengthHours = static_cast<int>(_tmpH);
  20. rs = sun_rise_set(year, month, day, longit, latit, &rise, &set);
  21. @@ -154,14 +154,14 @@ bool SunRiseSet::GetSunRiseSet(const double latit, const double longit, const in
  22. rise = UtcToLocal(rise, timezone);
  23. set = UtcToLocal(set, timezone);
  24. - result.SunAtSouthMin = static_cast<int>(std::round(modf((rise+set)/2.0, &_tmpH)*60));
  25. + result.SunAtSouthMin = static_cast<int>(round(modf((rise+set)/2.0, &_tmpH)*60));
  26. result.SunAtSouthHour = static_cast<int>(_tmpH);
  27. switch(rs) {
  28. case 0:
  29. - result.SunRiseMin = static_cast<int>(std::round(modf(rise, &_tmpH)*60));
  30. + result.SunRiseMin = static_cast<int>(round(modf(rise, &_tmpH)*60));
  31. result.SunRiseHour = static_cast<int>(_tmpH);
  32. - result.SunSetMin = static_cast<int>(std::round(modf(set, &_tmpH)*60));
  33. + result.SunSetMin = static_cast<int>(round(modf(set, &_tmpH)*60));
  34. result.SunSetHour = static_cast<int>(_tmpH);
  35. //fix a possible rounding issue above
  36. if (result.SunRiseMin > 59)
  37. @@ -189,9 +189,9 @@ bool SunRiseSet::GetSunRiseSet(const double latit, const double longit, const in
  38. case 0:
  39. civ_start = UtcToLocal(civ_start, timezone);
  40. civ_end = UtcToLocal(civ_end, timezone);
  41. - result.CivilTwilightStartMin = static_cast<int>(std::round(modf(civ_start, &_tmpH)*60));
  42. + result.CivilTwilightStartMin = static_cast<int>(round(modf(civ_start, &_tmpH)*60));
  43. result.CivilTwilightStartHour = static_cast<int>(_tmpH);
  44. - result.CivilTwilightEndMin = static_cast<int>(std::round(modf(civ_end, &_tmpH)*60));
  45. + result.CivilTwilightEndMin = static_cast<int>(round(modf(civ_end, &_tmpH)*60));
  46. result.CivilTwilightEndHour = static_cast<int>(_tmpH);
  47. break;
  48. case +1:
  49. @@ -208,9 +208,9 @@ bool SunRiseSet::GetSunRiseSet(const double latit, const double longit, const in
  50. case 0:
  51. naut_start = UtcToLocal(naut_start, timezone);
  52. naut_end = UtcToLocal(naut_end, timezone);
  53. - result.NauticalTwilightStartMin = static_cast<int>(std::round(modf(naut_start, &_tmpH)*60));
  54. + result.NauticalTwilightStartMin = static_cast<int>(round(modf(naut_start, &_tmpH)*60));
  55. result.NauticalTwilightStartHour = static_cast<int>(_tmpH);
  56. - result.NauticalTwilightEndMin = static_cast<int>(std::round(modf(naut_end, &_tmpH)*60));
  57. + result.NauticalTwilightEndMin = static_cast<int>(round(modf(naut_end, &_tmpH)*60));
  58. result.NauticalTwilightEndHour = static_cast<int>(_tmpH);
  59. break;
  60. case +1:
  61. @@ -227,9 +227,9 @@ bool SunRiseSet::GetSunRiseSet(const double latit, const double longit, const in
  62. case 0:
  63. astr_start = UtcToLocal(astr_start, timezone);
  64. astr_end = UtcToLocal(astr_end, timezone);
  65. - result.AstronomicalTwilightStartMin = static_cast<int>(std::round(modf(astr_start, &_tmpH)*60));
  66. + result.AstronomicalTwilightStartMin = static_cast<int>(round(modf(astr_start, &_tmpH)*60));
  67. result.AstronomicalTwilightStartHour = static_cast<int>(_tmpH);
  68. - result.AstronomicalTwilightEndMin = static_cast<int>(std::round(modf(astr_end, &_tmpH)*60));
  69. + result.AstronomicalTwilightEndMin = static_cast<int>(round(modf(astr_end, &_tmpH)*60));
  70. result.AstronomicalTwilightEndHour = static_cast<int>(_tmpH);
  71. break;
  72. case +1: