achaudhry / adhan

Raspberry Pi Adhan Clock
39 stars 25 forks source link

utcOffset rounding error #5

Closed rehanhaider closed 4 years ago

rehanhaider commented 4 years ago

Sorry I don't know about GitHub enough to contribute myself, however, I notices the the UTC offset calculation is rounding off to the nearest integer instead of at least one decimal place. utcOffset = -(time.timezone/3600)

This resulted in incorrect prayer timings for places with x.5 hours offset. This probably can be fixed by adding a decimal place in 3600 utcOffset = -(time.timezone/3600.0)

achaudhry commented 4 years ago

Umm I don't think adding a decimal as you've suggested makes a difference to be honest. It's not rounding it to integer for me. Which timezone are you in? I can see if I can reproduce the problem on my end and take it from there. Thanks

rehanhaider commented 4 years ago

India which is utc + 5.5

On 30 Apr 2020 at 1:24 am, Abrar Chaudhry notifications@github.com wrote:

Umm I don't think adding a decimal as you've suggested makes a difference to be honest. It's not rounding it to integer for me. Which timezone are you in? I can see if I can reproduce the problem on my end and take it from there. Thanks

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/achaudhry/adhan/issues/5#issuecomment-621428181, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA7VWY2HOQ7F56OYUQ3UJI3RPCAXHANCNFSM4MRI7FAA .

achaudhry commented 4 years ago

Could you give me a bit more information so that I can debug? What are you using for lat/lng, what's the calculation method and what's the actual vs expected result? Thanks

rehanhaider commented 4 years ago

Latitude: 28.474388 Longitude: 77.503990 Time zone: +5.5 UTC

I was expecting maghrib atound 6:50 PM, but was getting around 7:20 PM. Other timings were similarly off

achaudhry commented 4 years ago

@justgoodin if you change line 29, 30 and 31 as follows, you should see the correct times.

PT.setMethod('Karachi') utcOffset = 5.5 isDst = 0

I am not sure why raspberry pi is not picking up the correct settings for you, but that's ok. You can just hardcode those three variables for yourself and it should work fine. I just tried it and I'm getting the following prayer times which match what I'm seeing on most websites.

Screen Shot 2020-05-10 at 6 50 21 PM

Let me know if that works. Hope this helps! Enjoy the rest of your ramadan and remember me in your prayers :)

rehanhaider commented 4 years ago

Thanks bro, and Eid Mubarak