Fixes timezone bug and arithmetic overflow

pull/30/head
Alinson S. Xavier 11 years ago
parent 477eb80109
commit d8343105ec

@ -231,8 +231,8 @@ public class ShowHabitsFragment extends Fragment implements OnSavedListener, OnI
listView.setOnTouchListener(controller);
listView.setDragEnabled(true);
GregorianCalendar day = new GregorianCalendar();
day.setTimeInMillis(DateHelper.getLocalTime());
GregorianCalendar day = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
day.setTimeInMillis(DateHelper.getStartOfDay(DateHelper.getLocalTime()));
for (int i = 0; i < button_count; i++)
{

@ -9,6 +9,7 @@ import org.isoron.uhabits.R;
import android.annotation.SuppressLint;
import android.graphics.Color;
import android.util.Log;
import com.activeandroid.Model;
import com.activeandroid.annotation.Column;
@ -258,7 +259,7 @@ public class Habit extends Model
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();
int nDaysExtended = (int) ((timeTo - timeFromExtended) / DateHelper.millisecondsInOneDay);

Loading…
Cancel
Save