Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DST TIme #27

Open
maste98 opened this issue Apr 23, 2021 · 2 comments
Open

DST TIme #27

maste98 opened this issue Apr 23, 2021 · 2 comments

Comments

@maste98
Copy link

maste98 commented Apr 23, 2021

Is the dst functionality accurate? For example I live in America central time, we are currently in daylight savings, but when calculating salah times I have to put dst as 0, because if I put it as 1 it will be an hour ahead and inaccurate . Similarly when daylight savings turns off, I have to change the dst value to -1. I can still use it like this, but it seems as though the dst integer is off by 1, 0 should mean off(no dst), 1 should mean 1 hour of dst, etc.

@nurrakhmad
Copy link

nurrakhmad commented Apr 23, 2021 via email

@limooapp
Copy link

limooapp commented Apr 30, 2021

hello for calculate Automatic i use this method.
val location = Location(latitude, longitude, altitude, GMT_DEFF, DTS)

For DTS Automatic

   public int GMT_DSTSavings(){

        Calendar c = Calendar.getInstance();

        TimeZone z = c.getTimeZone();
        int offset = 0;
        if(z.inDaylightTime(new Date())){
            offset = z.getDSTSavings();
        }
        return offset / 1000 / 60 / 60;
    }

For GMT_DEFF Automatic

    public double GMT_Decimal(){

        Calendar c = Calendar.getInstance();

        int offsetHrs = offset / 1000 / 60 / 60;
        int offsetMins = offset / 1000 / 60 % 60;

        return Time_to_Decimal(offsetHrs,offsetMins,0);
    }

//Convert Time TO Decimal Double

    public double Time_to_Decimal(int hours , int minutes , int seconds){
        return  hours + (minutes * 0.016666666666667) + (seconds * 0.000277777777778);
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants