Merge pull request #1167 from triplem/date_util
Do calculations in a central place
This commit is contained in:
commit
98dedf117f
|
@ -119,6 +119,7 @@ import info.nightscout.utils.OKDialog;
|
|||
import info.nightscout.utils.Profiler;
|
||||
import info.nightscout.utils.SP;
|
||||
import info.nightscout.utils.SingleClickButton;
|
||||
import info.nightscout.utils.T;
|
||||
import info.nightscout.utils.ToastUtils;
|
||||
|
||||
import static info.nightscout.utils.DateUtil.now;
|
||||
|
@ -839,7 +840,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
if (wizard.superBolus) {
|
||||
final LoopPlugin loopPlugin = LoopPlugin.getPlugin();
|
||||
if (loopPlugin.isEnabled(PluginType.LOOP)) {
|
||||
loopPlugin.superBolusTo(System.currentTimeMillis() + 2 * 60L * 60 * 1000);
|
||||
loopPlugin.superBolusTo(System.currentTimeMillis() + T.hours(2).msecs());
|
||||
MainApp.bus().post(new EventRefreshOverview("WizardDialog"));
|
||||
}
|
||||
ConfigBuilderPlugin.getCommandQueue().tempBasalPercent(0, 120, true, profile, new Callback() {
|
||||
|
@ -1426,12 +1427,12 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
predHours = Math.max(0, predHours);
|
||||
hoursToFetch = rangeToDisplay - predHours;
|
||||
toTime = calendar.getTimeInMillis() + 100000; // little bit more to avoid wrong rounding - Graphview specific
|
||||
fromTime = toTime - hoursToFetch * 60 * 60 * 1000L;
|
||||
endTime = toTime + predHours * 60 * 60 * 1000L;
|
||||
fromTime = toTime - T.hours(hoursToFetch).msecs();
|
||||
endTime = toTime + T.hours(predHours).msecs();
|
||||
} else {
|
||||
hoursToFetch = rangeToDisplay;
|
||||
toTime = calendar.getTimeInMillis() + 100000; // little bit more to avoid wrong rounding - Graphview specific
|
||||
fromTime = toTime - hoursToFetch * 60 * 60 * 1000L;
|
||||
fromTime = toTime - T.hours(hoursToFetch).msecs();
|
||||
endTime = toTime;
|
||||
}
|
||||
|
||||
|
|
|
@ -179,5 +179,4 @@ public class DateUtil {
|
|||
public static long roundDateToSec(long date) {
|
||||
return date - date % 1000;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue