mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 09:08:52 -06:00
Fixes timezone bug and arithmetic overflow
This commit is contained in:
@@ -231,8 +231,8 @@ public class ShowHabitsFragment extends Fragment implements OnSavedListener, OnI
|
|||||||
listView.setOnTouchListener(controller);
|
listView.setOnTouchListener(controller);
|
||||||
listView.setDragEnabled(true);
|
listView.setDragEnabled(true);
|
||||||
|
|
||||||
GregorianCalendar day = new GregorianCalendar();
|
GregorianCalendar day = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
|
||||||
day.setTimeInMillis(DateHelper.getLocalTime());
|
day.setTimeInMillis(DateHelper.getStartOfDay(DateHelper.getLocalTime()));
|
||||||
|
|
||||||
for (int i = 0; i < button_count; i++)
|
for (int i = 0; i < button_count; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import org.isoron.uhabits.R;
|
|||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import com.activeandroid.Model;
|
import com.activeandroid.Model;
|
||||||
import com.activeandroid.annotation.Column;
|
import com.activeandroid.annotation.Column;
|
||||||
@@ -258,7 +259,7 @@ public class Habit extends Model
|
|||||||
|
|
||||||
public int[] getReps(long timeFrom, long timeTo)
|
public int[] getReps(long timeFrom, long timeTo)
|
||||||
{
|
{
|
||||||
long timeFromExtended = timeFrom - freq_den * DateHelper.millisecondsInOneDay;
|
long timeFromExtended = timeFrom - (long)(freq_den) * DateHelper.millisecondsInOneDay;
|
||||||
List<Repetition> reps = selectRepsFromTo(timeFromExtended, timeTo).execute();
|
List<Repetition> reps = selectRepsFromTo(timeFromExtended, timeTo).execute();
|
||||||
|
|
||||||
int nDaysExtended = (int) ((timeTo - timeFromExtended) / DateHelper.millisecondsInOneDay);
|
int nDaysExtended = (int) ((timeTo - timeFromExtended) / DateHelper.millisecondsInOneDay);
|
||||||
|
|||||||
Reference in New Issue
Block a user