radcheb / adhan Goto Github PK
View Code? Open in Web Editor NEWThis project forked from batoulapps/adhan
High precision prayer time library
License: MIT License
This project forked from batoulapps/adhan
High precision prayer time library
License: MIT License
time(0) return the time of the system. Inside the watch we have a custom os where this method is not overrided
Assalamu'alaikum wa rahmatullahi wa barakatuh,
Recently while using this repo on windows after found it working successfully on Linux, I found an error while running the tests:
[==========] Running 25 tests from 4 test suites.
[----------] Global test environment set-up.
[----------] 9 tests from PrayerTimesTest
[ RUN ] PrayerTimesTest.testDaysSinceSolstice
[ OK ] PrayerTimesTest.testDaysSinceSolstice (0 ms)
[ RUN ] PrayerTimesTest.testPrayerTimes
E:/AyahBot-Dev/Adhan/C/adhan/test/prayer_times_test.cpp:57: Failure
Expected equality of these values:
destString
Which is: "08:42 AM"
"04:42 AM"
[ FAILED ] PrayerTimesTest.testPrayerTimes (0 ms)
[ RUN ] PrayerTimesTest.testOffsets
E:/AyahBot-Dev/Adhan/C/adhan/test/prayer_times_test.cpp:90: Failure
Expected equality of these values:
destString
Which is: "10:35 AM"
"05:35 AM"
[ FAILED ] PrayerTimesTest.testOffsets (0 ms)
[ RUN ] PrayerTimesTest.testMoonsightingMethod
E:/AyahBot-Dev/Adhan/C/adhan/test/prayer_times_test.cpp:174: Failure
Expected equality of these values:
destString
Which is: "10:48 AM"
"05:48 AM"
[ FAILED ] PrayerTimesTest.testMoonsightingMethod (0 ms)
[ RUN ] PrayerTimesTest.testMoonsightingMethodHighLat
E:/AyahBot-Dev/Adhan/C/adhan/test/prayer_times_test.cpp:208: Failure
Expected equality of these values:
destString
Which is: "06:34 AM"
"07:34 AM"
[ FAILED ] PrayerTimesTest.testMoonsightingMethodHighLat (0 ms)
[ RUN ] PrayerTimesTest.testTimeForPrayer
[ OK ] PrayerTimesTest.testTimeForPrayer (0 ms)
[ RUN ] PrayerTimesTest.testCurrentPrayer
[ OK ] PrayerTimesTest.testCurrentPrayer (0 ms)
[ RUN ] PrayerTimesTest.testNextPrayer
[ OK ] PrayerTimesTest.testNextPrayer (0 ms)
[ RUN ] PrayerTimesTest.testPrayerTimesInTimezone
[ OK ] PrayerTimesTest.testPrayerTimesInTimezone (0 ms)
[----------] 9 tests from PrayerTimesTest (1 ms total)
[----------] 2 tests from CalculationMethodTest
[ RUN ] CalculationMethodTest.testNightPortion
[ OK ] CalculationMethodTest.testNightPortion (0 ms)
[ RUN ] CalculationMethodTest.testCalculationMethods
[ OK ] CalculationMethodTest.testCalculationMethods (0 ms)
[----------] 2 tests from CalculationMethodTest (0 ms total)
[----------] 2 tests from DoubleUtilsTest
[ RUN ] DoubleUtilsTest.testNormalizing
[ OK ] DoubleUtilsTest.testNormalizing (0 ms)
[ RUN ] DoubleUtilsTest.testClosestAngle
[ OK ] DoubleUtilsTest.testClosestAngle (0 ms)
[----------] 2 tests from DoubleUtilsTest (0 ms total)
[----------] 12 tests from AstronomicalTest
[ RUN ] AstronomicalTest.testAngleConversion
[ OK ] AstronomicalTest.testAngleConversion (0 ms)
[ RUN ] AstronomicalTest.testSolarCoordinates
[ OK ] AstronomicalTest.testSolarCoordinates (0 ms)
[ RUN ] AstronomicalTest.testRightAscensionEdgeCase
[ OK ] AstronomicalTest.testRightAscensionEdgeCase (7 ms)
[ RUN ] AstronomicalTest.testAltitudeOfCelestialBody
[ OK ] AstronomicalTest.testAltitudeOfCelestialBody (0 ms)
[ RUN ] AstronomicalTest.testTransitAndHourAngle
[ OK ] AstronomicalTest.testTransitAndHourAngle (0 ms)
[ RUN ] AstronomicalTest.testSolarTime
[ OK ] AstronomicalTest.testSolarTime (0 ms)
[ RUN ] AstronomicalTest.testCalendricalDate
[ OK ] AstronomicalTest.testCalendricalDate (0 ms)
[ RUN ] AstronomicalTest.testInterpolation
[ OK ] AstronomicalTest.testInterpolation (0 ms)
[ RUN ] AstronomicalTest.testAngleInterpolation
[ OK ] AstronomicalTest.testAngleInterpolation (0 ms)
[ RUN ] AstronomicalTest.testJulianDay
[ OK ] AstronomicalTest.testJulianDay (0 ms)
[ RUN ] AstronomicalTest.testJulianHours
[ OK ] AstronomicalTest.testJulianHours (0 ms)
[ RUN ] AstronomicalTest.testLeapYear
[ OK ] AstronomicalTest.testLeapYear (0 ms)
[----------] 12 tests from AstronomicalTest (7 ms total)
[----------] Global test environment tear-down
[==========] 25 tests from 4 test suites ran. (9 ms total)
[ PASSED ] 21 tests.
[ FAILED ] 4 tests, listed below:
[ FAILED ] PrayerTimesTest.testPrayerTimes
[ FAILED ] PrayerTimesTest.testOffsets
[ FAILED ] PrayerTimesTest.testMoonsightingMethod
[ FAILED ] PrayerTimesTest.testMoonsightingMethodHighLat
4 FAILED TESTS
Can you look thoroughly into this issue?
You have to define the constant yourself
@radcheb This kind of methods is a little bit dangerous for the integrity of the memory...
This method will allocate dynamically some space for the solar_time_t struct and we are not sure where the allocated memory will be freed
solar_time_t * new_solar_time(const time_t today_time, coordinates_t *coordinates) {
...
solar_time_t *result = malloc(sizeof(solar_time_t));
*(double *) &result->transit = transit;
*(double *) &result->sunrise = sunrise;
*(double *) &result->sunset = sunset;
*(coordinates_t **) &result->observer = observer;
*(solar_coordinates_t **) &result->solar = solar;
*(solar_coordinates_t **) &result->prevSolar = prevSolar;
*(solar_coordinates_t **) &result->nextSolar = nextSolar;
*(double *) &result->approximateTransit = approximateTransit;
return result;
}
I suggest you to do something like this instead:
void new_solar_time(const time_t today_time, coordinates_t *coordinates, solar_time_t * solar_time) {
...
*(double *) &result->transit = transit;
*(double *) &result->sunrise = sunrise;
*(double *) &result->sunset = sunset;
*(coordinates_t **) &result->observer = observer;
*(solar_coordinates_t **) &result->solar = solar;
*(solar_coordinates_t **) &result->prevSolar = prevSolar;
*(solar_coordinates_t **) &result->nextSolar = nextSolar;
*(double *) &result->approximateTransit = approximateTransit;
}
have this:
struct tm *resolve_time_2(int year, int month, int day);
#endif //C_DATA_COMPONENTS_H
struct tm *get_date_components(struct tm *date);
instead of:
struct tm *resolve_time_2(int year, int month, int day);
struct tm *get_date_components(struct tm *date);
#endif //C_DATA_COMPONENTS_H
Here is the warning message:
avertissement : left-hand operand of comma expression has no effect [-Wunused-value]
return (time_components *) (hours, minutes, seconds);
Hello! I want to retrieve the paramaters of a corresponding methods. I have done something like this:
calculation_method method;
switch(Factory::methodFunction.getMethod()) // list of supported methods
{
case 1:
method = EGYPTIAN;
break;
case 2:
method = KARACHI;
break;
case 3:
method = GULF;
break;
case 4:
method = UMM_AL_QURA;
break;
case 5:
method = QATAR;
break;
case 6:
method = MOON_SIGHTING_COMMITTEE;
break;
case 7: // Personal method selected
method = OTHER;
conf = new_calculation_parameters(Factory::methodFunction.getFajr(),
Factory::methodFunction.getIsha());
conf.highLatitudeRule = MIDDLE_OF_THE_NIGHT;
// Get the Asr ratio
conf.madhab = (madhab_t) Factory::methodFunction.getAsr();
conf.highLatitudeRule = (high_latitude_rule_t) Factory::methodFunction.getHighLat();
// Get the High Latitude calculation method
break;
default: break;
}
But it's incomplete...
I need a method like this:
calculation_parameters_t *calculation_parameters = getParameters(&method);
How can I perform this ?
maybe you should put inline at the end when everything is working. This is just to optimize the size of the code.
What is the method I need to use to get the direction of the Qibla from the north?
The input of the method should be a location in latitude and longitude.
@radcheb Be careful, the timegm function is only available on a linux OS. I can give you a time_t struct with the UTC time.
Has anyone got a compiled version of the C library?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.