Giter VIP home page Giter VIP logo

adhan's People

Contributors

ahmedre avatar cyrillius avatar meltuhamy avatar mmmoussa avatar radcheb avatar z3bi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

adhan's Issues

Wrong usage of inline

maybe you should put inline at the end when everything is working. This is just to optimize the size of the code.

use of the memory in a embedded system

@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;
}

how to get param from method?

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 ?

Prayer Times Tests Fail on Windows MSYS2 and MinGW

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?

time(0) can't be used

time(0) return the time of the system. Inside the watch we have a custom os where this method is not overrided

[Compilation] End of include ifdef misplaced in data_components.h

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.