use System.currentTimeMillis()
This commit is contained in:
parent
26daffa692
commit
43231cc362
|
@ -514,7 +514,7 @@ public class DataService extends IntentService {
|
|||
|
||||
if (trJson.getString("eventType").equals(CareportalEvent.ANNOUNCEMENT)) {
|
||||
long date = trJson.getLong("mills");
|
||||
long now = new Date().getTime();
|
||||
long now = System.currentTimeMillis();
|
||||
if (date > now - 15 * 60 * 1000L && trJson.has("notes")) {
|
||||
Notification announcement = new Notification(Notification.NSANNOUNCEMENT, trJson.getString("notes"), Notification.ANNOUNCEMENT, 60);
|
||||
MainApp.bus().post(new EventNewNotification(announcement));
|
||||
|
|
|
@ -16,7 +16,7 @@ import info.nightscout.androidaps.interfaces.InsulinInterface;
|
|||
*/
|
||||
|
||||
public class DetailedBolusInfo {
|
||||
public long date = new Date().getTime();
|
||||
public long date = System.currentTimeMillis();
|
||||
public InsulinInterface insulinInterface = MainApp.getConfigBuilder().getActiveInsulin();
|
||||
public String eventType = CareportalEvent.MEALBOLUS;
|
||||
public double insulin = 0;
|
||||
|
|
|
@ -67,11 +67,11 @@ public class GlucoseStatus {
|
|||
@Nullable
|
||||
public static GlucoseStatus getGlucoseStatusData() {
|
||||
// load 45min
|
||||
long fromtime = (long) (new Date().getTime() - 60 * 1000L * 45);
|
||||
long fromtime = (long) (System.currentTimeMillis() - 60 * 1000L * 45);
|
||||
List<BgReading> data = MainApp.getDbHelper().getBgreadingsDataFromTime(fromtime, false);
|
||||
|
||||
int sizeRecords = data.size();
|
||||
if (sizeRecords < 1 || data.get(0).date < new Date().getTime() - 7 * 60 * 1000L) {
|
||||
if (sizeRecords < 1 || data.get(0).date < System.currentTimeMillis() - 7 * 60 * 1000L) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -215,7 +215,7 @@ public class Profile {
|
|||
}
|
||||
|
||||
public Double getIsf() {
|
||||
return getIsf(secondsFromMidnight(new Date().getTime()));
|
||||
return getIsf(secondsFromMidnight(System.currentTimeMillis()));
|
||||
}
|
||||
|
||||
public Double getIsf(long time) {
|
||||
|
@ -233,7 +233,7 @@ public class Profile {
|
|||
}
|
||||
|
||||
public Double getIc() {
|
||||
return getIc(secondsFromMidnight(new Date().getTime()));
|
||||
return getIc(secondsFromMidnight(System.currentTimeMillis()));
|
||||
}
|
||||
|
||||
public Double getIc(long time) {
|
||||
|
@ -251,7 +251,7 @@ public class Profile {
|
|||
}
|
||||
|
||||
public Double getBasal() {
|
||||
return getBasal(secondsFromMidnight(new Date().getTime()));
|
||||
return getBasal(secondsFromMidnight(System.currentTimeMillis()));
|
||||
}
|
||||
|
||||
public Double getBasal(long time) {
|
||||
|
@ -296,7 +296,7 @@ public class Profile {
|
|||
}
|
||||
|
||||
public Double getTargetLow() {
|
||||
return getTargetLow(secondsFromMidnight(new Date().getTime()));
|
||||
return getTargetLow(secondsFromMidnight(System.currentTimeMillis()));
|
||||
}
|
||||
|
||||
public Double getTargetLow(long time) {
|
||||
|
@ -308,7 +308,7 @@ public class Profile {
|
|||
}
|
||||
|
||||
public Double getTargetHigh() {
|
||||
return getTargetHigh(secondsFromMidnight(new Date().getTime()));
|
||||
return getTargetHigh(secondsFromMidnight(System.currentTimeMillis()));
|
||||
}
|
||||
|
||||
public Double getTargetHigh(long time) {
|
||||
|
|
|
@ -81,15 +81,15 @@ public class CareportalEvent implements DataPointWithLabelInterface {
|
|||
}
|
||||
|
||||
public long getMillisecondsFromStart() {
|
||||
return new Date().getTime() - date;
|
||||
return System.currentTimeMillis() - date;
|
||||
}
|
||||
|
||||
public long getHoursFromStart() {
|
||||
return (new Date().getTime() - date) / (60 * 1000);
|
||||
return (System.currentTimeMillis() - date) / (60 * 1000);
|
||||
}
|
||||
|
||||
public String age() {
|
||||
Map<TimeUnit, Long> diff = computeDiff(date, new Date().getTime());
|
||||
Map<TimeUnit, Long> diff = computeDiff(date, System.currentTimeMillis());
|
||||
return diff.get(TimeUnit.DAYS) + " " + MainApp.sResources.getString(R.string.days) + " " + diff.get(TimeUnit.HOURS) + " " + MainApp.sResources.getString(R.string.hours);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
|
@ -142,35 +141,35 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
public void cleanUpDatabases() {
|
||||
// TODO: call it somewhere
|
||||
log.debug("Before BgReadings size: " + DatabaseUtils.queryNumEntries(getReadableDatabase(), DATABASE_BGREADINGS));
|
||||
getWritableDatabase().delete(DATABASE_BGREADINGS, "date" + " < '" + (new Date().getTime() - Constants.hoursToKeepInDatabase * 60 * 60 * 1000L) + "'", null);
|
||||
getWritableDatabase().delete(DATABASE_BGREADINGS, "date" + " < '" + (System.currentTimeMillis() - Constants.hoursToKeepInDatabase * 60 * 60 * 1000L) + "'", null);
|
||||
log.debug("After BgReadings size: " + DatabaseUtils.queryNumEntries(getReadableDatabase(), DATABASE_BGREADINGS));
|
||||
|
||||
log.debug("Before TempTargets size: " + DatabaseUtils.queryNumEntries(getReadableDatabase(), DATABASE_TEMPTARGETS));
|
||||
getWritableDatabase().delete(DATABASE_TEMPTARGETS, "date" + " < '" + (new Date().getTime() - Constants.hoursToKeepInDatabase * 60 * 60 * 1000L) + "'", null);
|
||||
getWritableDatabase().delete(DATABASE_TEMPTARGETS, "date" + " < '" + (System.currentTimeMillis() - Constants.hoursToKeepInDatabase * 60 * 60 * 1000L) + "'", null);
|
||||
log.debug("After TempTargets size: " + DatabaseUtils.queryNumEntries(getReadableDatabase(), DATABASE_TEMPTARGETS));
|
||||
|
||||
log.debug("Before Treatments size: " + DatabaseUtils.queryNumEntries(getReadableDatabase(), DATABASE_TREATMENTS));
|
||||
getWritableDatabase().delete(DATABASE_TREATMENTS, "date" + " < '" + (new Date().getTime() - Constants.hoursToKeepInDatabase * 60 * 60 * 1000L) + "'", null);
|
||||
getWritableDatabase().delete(DATABASE_TREATMENTS, "date" + " < '" + (System.currentTimeMillis() - Constants.hoursToKeepInDatabase * 60 * 60 * 1000L) + "'", null);
|
||||
log.debug("After Treatments size: " + DatabaseUtils.queryNumEntries(getReadableDatabase(), DATABASE_TREATMENTS));
|
||||
|
||||
log.debug("Before History size: " + DatabaseUtils.queryNumEntries(getReadableDatabase(), DATABASE_DANARHISTORY));
|
||||
getWritableDatabase().delete(DATABASE_DANARHISTORY, "recordDate" + " < '" + (new Date().getTime() - Constants.daysToKeepHistoryInDatabase * 24 * 60 * 60 * 1000L) + "'", null);
|
||||
getWritableDatabase().delete(DATABASE_DANARHISTORY, "recordDate" + " < '" + (System.currentTimeMillis() - Constants.daysToKeepHistoryInDatabase * 24 * 60 * 60 * 1000L) + "'", null);
|
||||
log.debug("After History size: " + DatabaseUtils.queryNumEntries(getReadableDatabase(), DATABASE_DANARHISTORY));
|
||||
|
||||
log.debug("Before TemporaryBasals size: " + DatabaseUtils.queryNumEntries(getReadableDatabase(), DATABASE_TEMPORARYBASALS));
|
||||
getWritableDatabase().delete(DATABASE_TEMPORARYBASALS, "recordDate" + " < '" + (new Date().getTime() - Constants.daysToKeepHistoryInDatabase * 24 * 60 * 60 * 1000L) + "'", null);
|
||||
getWritableDatabase().delete(DATABASE_TEMPORARYBASALS, "recordDate" + " < '" + (System.currentTimeMillis() - Constants.daysToKeepHistoryInDatabase * 24 * 60 * 60 * 1000L) + "'", null);
|
||||
log.debug("After TemporaryBasals size: " + DatabaseUtils.queryNumEntries(getReadableDatabase(), DATABASE_TEMPORARYBASALS));
|
||||
|
||||
log.debug("Before ExtendedBoluses size: " + DatabaseUtils.queryNumEntries(getReadableDatabase(), DATABASE_EXTENDEDBOLUSES));
|
||||
getWritableDatabase().delete(DATABASE_EXTENDEDBOLUSES, "recordDate" + " < '" + (new Date().getTime() - Constants.daysToKeepHistoryInDatabase * 24 * 60 * 60 * 1000L) + "'", null);
|
||||
getWritableDatabase().delete(DATABASE_EXTENDEDBOLUSES, "recordDate" + " < '" + (System.currentTimeMillis() - Constants.daysToKeepHistoryInDatabase * 24 * 60 * 60 * 1000L) + "'", null);
|
||||
log.debug("After ExtendedBoluses size: " + DatabaseUtils.queryNumEntries(getReadableDatabase(), DATABASE_EXTENDEDBOLUSES));
|
||||
|
||||
log.debug("Before CareportalEvent size: " + DatabaseUtils.queryNumEntries(getReadableDatabase(), DATABASE_CAREPORTALEVENTS));
|
||||
getWritableDatabase().delete(DATABASE_CAREPORTALEVENTS, "recordDate" + " < '" + (new Date().getTime() - Constants.daysToKeepHistoryInDatabase * 24 * 60 * 60 * 1000L) + "'", null);
|
||||
getWritableDatabase().delete(DATABASE_CAREPORTALEVENTS, "recordDate" + " < '" + (System.currentTimeMillis() - Constants.daysToKeepHistoryInDatabase * 24 * 60 * 60 * 1000L) + "'", null);
|
||||
log.debug("After CareportalEvent size: " + DatabaseUtils.queryNumEntries(getReadableDatabase(), DATABASE_CAREPORTALEVENTS));
|
||||
|
||||
log.debug("Before ProfileSwitch size: " + DatabaseUtils.queryNumEntries(getReadableDatabase(), DATABASE_PROFILESWITCHES));
|
||||
getWritableDatabase().delete(DATABASE_PROFILESWITCHES, "recordDate" + " < '" + (new Date().getTime() - Constants.daysToKeepHistoryInDatabase * 24 * 60 * 60 * 1000L) + "'", null);
|
||||
getWritableDatabase().delete(DATABASE_PROFILESWITCHES, "recordDate" + " < '" + (System.currentTimeMillis() - Constants.daysToKeepHistoryInDatabase * 24 * 60 * 60 * 1000L) + "'", null);
|
||||
log.debug("After ProfileSwitch size: " + DatabaseUtils.queryNumEntries(getReadableDatabase(), DATABASE_PROFILESWITCHES));
|
||||
}
|
||||
|
||||
|
@ -406,7 +405,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
if (lastBg == null)
|
||||
return null;
|
||||
|
||||
if (lastBg.date > new Date().getTime() - 9 * 60 * 1000)
|
||||
if (lastBg.date > System.currentTimeMillis() - 9 * 60 * 1000)
|
||||
return lastBg;
|
||||
|
||||
return null;
|
||||
|
|
|
@ -139,7 +139,7 @@ public class ExtendedBolus implements Interval, DataPointWithLabelInterface {
|
|||
|
||||
@Override
|
||||
public boolean isInProgress() {
|
||||
return match(new Date().getTime());
|
||||
return match(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -202,7 +202,7 @@ public class ExtendedBolus implements Interval, DataPointWithLabelInterface {
|
|||
}
|
||||
|
||||
public int getRealDuration() {
|
||||
return getDurationToTime(new Date().getTime());
|
||||
return getDurationToTime(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
private int getDurationToTime(long time) {
|
||||
|
@ -212,7 +212,7 @@ public class ExtendedBolus implements Interval, DataPointWithLabelInterface {
|
|||
}
|
||||
|
||||
public int getPlannedRemainingMinutes() {
|
||||
float remainingMin = (end() - new Date().getTime()) / 1000f / 60;
|
||||
float remainingMin = (end() - System.currentTimeMillis()) / 1000f / 60;
|
||||
return (remainingMin < 0) ? 0 : Math.round(remainingMin);
|
||||
}
|
||||
|
||||
|
|
|
@ -148,7 +148,7 @@ public class ProfileSwitch implements Interval, DataPointWithLabelInterface {
|
|||
|
||||
@Override
|
||||
public boolean isInProgress() {
|
||||
return match(new Date().getTime());
|
||||
return match(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -115,7 +115,7 @@ public class TempTarget implements Interval {
|
|||
|
||||
@Override
|
||||
public boolean isInProgress() {
|
||||
return match(new Date().getTime());
|
||||
return match(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -159,7 +159,7 @@ public class TemporaryBasal implements Interval {
|
|||
|
||||
@Override
|
||||
public boolean isInProgress() {
|
||||
return match(new Date().getTime());
|
||||
return match(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -222,7 +222,7 @@ public class TemporaryBasal implements Interval {
|
|||
}
|
||||
|
||||
public int getRealDuration() {
|
||||
return getDurationToTime(new Date().getTime());
|
||||
return getDurationToTime(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
private int getDurationToTime(long time) {
|
||||
|
@ -232,7 +232,7 @@ public class TemporaryBasal implements Interval {
|
|||
}
|
||||
|
||||
public int getPlannedRemainingMinutes() {
|
||||
float remainingMin = (end() - new Date().getTime()) / 1000f / 60;
|
||||
float remainingMin = (end() - System.currentTimeMillis()) / 1000f / 60;
|
||||
return (remainingMin < 0) ? 0 : Math.round(remainingMin);
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ public class Treatment implements DataPointWithLabelInterface {
|
|||
}
|
||||
|
||||
public long getMillisecondsFromStart() {
|
||||
return new Date().getTime() - date;
|
||||
return System.currentTimeMillis() - date;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
|
|
|
@ -143,7 +143,7 @@ public class ActionsFragment extends Fragment implements View.OnClickListener {
|
|||
extendedBolusCancel.setVisibility(View.GONE);
|
||||
else {
|
||||
extendedBolusCancel.setVisibility(View.VISIBLE);
|
||||
ExtendedBolus running = MainApp.getConfigBuilder().getExtendedBolusFromHistory(new Date().getTime());
|
||||
ExtendedBolus running = MainApp.getConfigBuilder().getExtendedBolusFromHistory(System.currentTimeMillis());
|
||||
extendedBolusCancel.setText(MainApp.instance().getString(R.string.cancel) + " " + running.toString());
|
||||
}
|
||||
if (!MainApp.getConfigBuilder().getPumpDescription().isTempBasalCapable || !MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended() || MainApp.getConfigBuilder().isTempBasalInProgress())
|
||||
|
|
|
@ -617,7 +617,7 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
|
|||
try {
|
||||
String profileName = data.getString("profile");
|
||||
ProfileSwitch profileSwitch = new ProfileSwitch();
|
||||
profileSwitch.date = new Date().getTime();
|
||||
profileSwitch.date = System.currentTimeMillis();
|
||||
profileSwitch.source = Source.USER;
|
||||
profileSwitch.profileName = profileName;
|
||||
profileSwitch.profileJson = profileStore.getSpecificProfile(profileName).getData().toString();
|
||||
|
|
|
@ -437,7 +437,7 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
|||
t.insulin = result.bolusDelivered;
|
||||
if (carbTime == 0)
|
||||
t.carbs = (double) result.carbsDelivered; // with different carbTime record will come back from nightscout
|
||||
t.date = new Date().getTime();
|
||||
t.date = System.currentTimeMillis();
|
||||
t.mealBolus = result.carbsDelivered > 0;
|
||||
addToHistoryTreatment(t);
|
||||
t.carbs = (double) result.carbsDelivered;
|
||||
|
@ -512,7 +512,7 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
|||
Treatment t = new Treatment(insulinType);
|
||||
t.insulin = result.bolusDelivered;
|
||||
t.carbs = (double) result.carbsDelivered;
|
||||
t.date = new Date().getTime();
|
||||
t.date = System.currentTimeMillis();
|
||||
t.mealBolus = t.carbs > 0;
|
||||
addToHistoryTreatment(t);
|
||||
NSUpload.uploadTreatment(t);
|
||||
|
@ -633,7 +633,7 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
|||
} else if (isTempBasalInProgress() && Math.abs(request.rate - getTempBasalAbsoluteRateHistory()) < 0.05) {
|
||||
result = new PumpEnactResult();
|
||||
result.absolute = getTempBasalAbsoluteRateHistory();
|
||||
result.duration = getTempBasalFromHistory(new Date().getTime()).getPlannedRemainingMinutes();
|
||||
result.duration = getTempBasalFromHistory(System.currentTimeMillis()).getPlannedRemainingMinutes();
|
||||
result.enacted = false;
|
||||
result.comment = "Temp basal set correctly";
|
||||
result.success = true;
|
||||
|
@ -982,7 +982,7 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
|||
}
|
||||
|
||||
public String getProfileName() {
|
||||
return getProfileName(new Date().getTime());
|
||||
return getProfileName(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
public String getProfileName(long time) {
|
||||
|
@ -1005,7 +1005,7 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
|||
}
|
||||
|
||||
public Profile getProfile() {
|
||||
return getProfile(new Date().getTime());
|
||||
return getProfile(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
public String getProfileUnits() {
|
||||
|
|
|
@ -91,7 +91,7 @@ public class ObjectivesFragment extends Fragment {
|
|||
}
|
||||
});
|
||||
|
||||
Long now = new Date().getTime();
|
||||
Long now = System.currentTimeMillis();
|
||||
if (position > 0 && objectives.get(position - 1).accomplished.getTime() == 0) {
|
||||
// Phase 0: previous not completed
|
||||
holder.startedLayout.setVisibility(View.GONE);
|
||||
|
|
|
@ -22,7 +22,7 @@ public class AutosensData {
|
|||
}
|
||||
|
||||
public int minOld() {
|
||||
return (int) ((new Date().getTime() - time) / 1000 / 60);
|
||||
return (int) ((System.currentTimeMillis() - time) / 1000 / 60);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -158,7 +158,7 @@ public class IobCobCalculatorPlugin implements PluginBase {
|
|||
//log.debug("Locking loadBgData");
|
||||
synchronized (dataLock) {
|
||||
onNewProfile(null);
|
||||
bgReadings = MainApp.getDbHelper().getBgreadingsDataFromTime((long) (new Date().getTime() - 60 * 60 * 1000L * (24 + dia)), false);
|
||||
bgReadings = MainApp.getDbHelper().getBgreadingsDataFromTime((long) (System.currentTimeMillis() - 60 * 60 * 1000L * (24 + dia)), false);
|
||||
log.debug("BG data loaded. Size: " + bgReadings.size());
|
||||
}
|
||||
//log.debug("Releasing loadBgData");
|
||||
|
@ -393,7 +393,7 @@ public class IobCobCalculatorPlugin implements PluginBase {
|
|||
}
|
||||
|
||||
public static IobTotal calulateFromTreatmentsAndTemps(long time) {
|
||||
long now = new Date().getTime();
|
||||
long now = System.currentTimeMillis();
|
||||
time = roundUpTime(time);
|
||||
if (time < now && iobTable.get(time) != null) {
|
||||
//og.debug(">>> calulateFromTreatmentsAndTemps Cache hit " + new Date(time).toLocaleString());
|
||||
|
@ -405,7 +405,7 @@ public class IobCobCalculatorPlugin implements PluginBase {
|
|||
IobTotal basalIob = MainApp.getConfigBuilder().getCalculationToTimeTempBasals(time).round();
|
||||
|
||||
IobTotal iobTotal = IobTotal.combine(bolusIob, basalIob).round();
|
||||
if (time < new Date().getTime()) {
|
||||
if (time < System.currentTimeMillis()) {
|
||||
iobTable.put(time, iobTotal);
|
||||
}
|
||||
return iobTotal;
|
||||
|
@ -423,7 +423,7 @@ public class IobCobCalculatorPlugin implements PluginBase {
|
|||
}
|
||||
|
||||
public static BasalData getBasalData(long time) {
|
||||
long now = new Date().getTime();
|
||||
long now = System.currentTimeMillis();
|
||||
time = roundUpTime(time);
|
||||
BasalData retval = basalDataTable.get(time);
|
||||
if (retval == null) {
|
||||
|
@ -448,7 +448,7 @@ public class IobCobCalculatorPlugin implements PluginBase {
|
|||
}
|
||||
|
||||
public static AutosensData getAutosensData(long time) {
|
||||
long now = new Date().getTime();
|
||||
long now = System.currentTimeMillis();
|
||||
if (time > now)
|
||||
return null;
|
||||
Long previous = findPreviousTimeFromBucketedData(time);
|
||||
|
@ -469,7 +469,7 @@ public class IobCobCalculatorPlugin implements PluginBase {
|
|||
if (autosensDataTable.size() < 1)
|
||||
return null;
|
||||
AutosensData data = autosensDataTable.valueAt(autosensDataTable.size() - 1);
|
||||
if (data.time < new Date().getTime() - 5 * 60 * 1000) {
|
||||
if (data.time < System.currentTimeMillis() - 5 * 60 * 1000) {
|
||||
return null;
|
||||
} else {
|
||||
return data;
|
||||
|
@ -479,7 +479,7 @@ public class IobCobCalculatorPlugin implements PluginBase {
|
|||
public static IobTotal[] calculateIobArrayInDia() {
|
||||
Profile profile = MainApp.getConfigBuilder().getProfile();
|
||||
// predict IOB out to DIA plus 30m
|
||||
long time = new Date().getTime();
|
||||
long time = System.currentTimeMillis();
|
||||
time = roundUpTime(time);
|
||||
int len = (int) ((profile.getDia() * 60 + 30) / 5);
|
||||
IobTotal[] array = new IobTotal[len];
|
||||
|
|
|
@ -167,7 +167,7 @@ public class LoopPlugin implements PluginBase {
|
|||
if (loopSuspendedTill == 0)
|
||||
return 0;
|
||||
|
||||
long now = new Date().getTime();
|
||||
long now = System.currentTimeMillis();
|
||||
long msecDiff = loopSuspendedTill - now;
|
||||
|
||||
if (loopSuspendedTill <= now) { // time exceeded
|
||||
|
@ -182,7 +182,7 @@ public class LoopPlugin implements PluginBase {
|
|||
if (loopSuspendedTill == 0)
|
||||
return false;
|
||||
|
||||
long now = new Date().getTime();
|
||||
long now = System.currentTimeMillis();
|
||||
|
||||
if (loopSuspendedTill <= now) { // time exceeded
|
||||
suspendTo(0L);
|
||||
|
@ -196,7 +196,7 @@ public class LoopPlugin implements PluginBase {
|
|||
if (loopSuspendedTill == 0)
|
||||
return false;
|
||||
|
||||
long now = new Date().getTime();
|
||||
long now = System.currentTimeMillis();
|
||||
|
||||
if (loopSuspendedTill <= now) { // time exceeded
|
||||
suspendTo(0L);
|
||||
|
|
|
@ -63,7 +63,7 @@ public class DBAccessReceiver extends BroadcastReceiver {
|
|||
data = new JSONObject();
|
||||
}
|
||||
// mark by id
|
||||
Long nsclientid = new Date().getTime();
|
||||
Long nsclientid = System.currentTimeMillis();
|
||||
try {
|
||||
data.put("NSCLIENT_ID", nsclientid);
|
||||
} catch (JSONException e) {
|
||||
|
|
|
@ -484,7 +484,7 @@ public class NSClientService extends Service {
|
|||
// remove from upload queue if Ack is failing
|
||||
UploadQueue.removeID(jsonTreatment);
|
||||
//Find latest date in treatment
|
||||
if (treatment.getMills() != null && treatment.getMills() < new Date().getTime())
|
||||
if (treatment.getMills() != null && treatment.getMills() < System.currentTimeMillis())
|
||||
if (treatment.getMills() > latestDateInReceivedData)
|
||||
latestDateInReceivedData = treatment.getMills();
|
||||
|
||||
|
@ -493,7 +493,7 @@ public class NSClientService extends Service {
|
|||
} else if (treatment.getAction().equals("update")) {
|
||||
updatedTreatments.put(jsonTreatment);
|
||||
} else if (treatment.getAction().equals("remove")) {
|
||||
if (treatment.getMills() != null && treatment.getMills() > new Date().getTime() - 24 * 60 * 60 * 1000L) // handle 1 day old deletions only
|
||||
if (treatment.getMills() != null && treatment.getMills() > System.currentTimeMillis() - 24 * 60 * 60 * 1000L) // handle 1 day old deletions only
|
||||
removedTreatments.put(jsonTreatment);
|
||||
}
|
||||
}
|
||||
|
@ -554,7 +554,7 @@ public class NSClientService extends Service {
|
|||
// remove from upload queue if Ack is failing
|
||||
UploadQueue.removeID(jsonSgv);
|
||||
//Find latest date in sgv
|
||||
if (sgv.getMills() != null && sgv.getMills() < new Date().getTime())
|
||||
if (sgv.getMills() != null && sgv.getMills() < System.currentTimeMillis())
|
||||
if (sgv.getMills() > latestDateInReceivedData)
|
||||
latestDateInReceivedData = sgv.getMills();
|
||||
}
|
||||
|
@ -676,11 +676,11 @@ public class NSClientService extends Service {
|
|||
public void run() {
|
||||
if (mSocket == null || !mSocket.connected()) return;
|
||||
|
||||
if (lastResendTime > new Date().getTime() - 10 * 1000L) {
|
||||
log.debug("Skipping resend by lastResendTime: " + ((new Date().getTime() - lastResendTime) / 1000L) + " sec");
|
||||
if (lastResendTime > System.currentTimeMillis() - 10 * 1000L) {
|
||||
log.debug("Skipping resend by lastResendTime: " + ((System.currentTimeMillis() - lastResendTime) / 1000L) + " sec");
|
||||
return;
|
||||
}
|
||||
lastResendTime = new Date().getTime();
|
||||
lastResendTime = System.currentTimeMillis();
|
||||
|
||||
MainApp.bus().post(new EventNSClientNewLog("QUEUE", "Resend started: " + reason));
|
||||
|
||||
|
|
|
@ -232,7 +232,7 @@ public class DetermineBasalAdapterAMAJS {
|
|||
mCurrentTemp.add("rate", MainApp.getConfigBuilder().getTempBasalAbsoluteRateHistory());
|
||||
|
||||
// as we have non default temps longer than 30 mintues
|
||||
TemporaryBasal tempBasal = MainApp.getConfigBuilder().getTempBasalFromHistory(new Date().getTime());
|
||||
TemporaryBasal tempBasal = MainApp.getConfigBuilder().getTempBasalFromHistory(System.currentTimeMillis());
|
||||
if (tempBasal != null) {
|
||||
mCurrentTemp.add("minutesrunning", tempBasal.getRealDuration());
|
||||
}
|
||||
|
|
|
@ -187,7 +187,7 @@ public class OpenAPSAMAPlugin implements PluginBase, APSInterface {
|
|||
targetBg = verifyHardLimits(targetBg, "targetBg", Constants.VERY_HARD_LIMIT_TARGET_BG[0], Constants.VERY_HARD_LIMIT_TARGET_BG[1]);
|
||||
|
||||
boolean isTempTarget = false;
|
||||
TempTarget tempTarget = MainApp.getConfigBuilder().getTempTargetFromHistory(new Date().getTime());
|
||||
TempTarget tempTarget = MainApp.getConfigBuilder().getTempTargetFromHistory(System.currentTimeMillis());
|
||||
if (tempTarget != null) {
|
||||
isTempTarget = true;
|
||||
minBg = verifyHardLimits(tempTarget.low, "minBg", Constants.VERY_HARD_LIMIT_TEMP_MIN_BG[0], Constants.VERY_HARD_LIMIT_TEMP_MIN_BG[1]);
|
||||
|
@ -208,7 +208,7 @@ public class OpenAPSAMAPlugin implements PluginBase, APSInterface {
|
|||
if (!checkOnlyHardLimits(pump.getBaseBasalRate(), "current_basal", 0.01, 5)) return;
|
||||
|
||||
long oldestDataAvailable = MainApp.getConfigBuilder().oldestDataAvailable();
|
||||
long getBGDataFrom = Math.max(oldestDataAvailable, (long) (new Date().getTime() - 60 * 60 * 1000L * (24 + profile.getDia())));
|
||||
long getBGDataFrom = Math.max(oldestDataAvailable, (long) (System.currentTimeMillis() - 60 * 60 * 1000L * (24 + profile.getDia())));
|
||||
log.debug("Limiting data to oldest available temps: " + new Date(oldestDataAvailable).toString());
|
||||
|
||||
startPart = new Date();
|
||||
|
|
|
@ -186,7 +186,7 @@ public class OpenAPSMAPlugin implements PluginBase, APSInterface {
|
|||
maxBg = verifyHardLimits(maxBg, "maxBg", Constants.VERY_HARD_LIMIT_MAX_BG[0], Constants.VERY_HARD_LIMIT_MAX_BG[1]);
|
||||
targetBg = verifyHardLimits(targetBg, "targetBg", Constants.VERY_HARD_LIMIT_TARGET_BG[0], Constants.VERY_HARD_LIMIT_TARGET_BG[1]);
|
||||
|
||||
TempTarget tempTarget = MainApp.getConfigBuilder().getTempTargetFromHistory(new Date().getTime());
|
||||
TempTarget tempTarget = MainApp.getConfigBuilder().getTempTargetFromHistory(System.currentTimeMillis());
|
||||
if (tempTarget != null) {
|
||||
minBg = verifyHardLimits(tempTarget.low, "minBg", Constants.VERY_HARD_LIMIT_TEMP_MIN_BG[0], Constants.VERY_HARD_LIMIT_TEMP_MIN_BG[1]);
|
||||
maxBg = verifyHardLimits(tempTarget.high, "maxBg", Constants.VERY_HARD_LIMIT_TEMP_MAX_BG[0], Constants.VERY_HARD_LIMIT_TEMP_MAX_BG[1]);
|
||||
|
|
|
@ -148,7 +148,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
|
|||
activity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (ConfigBuilderPlugin.getActiveAPS() instanceof OpenAPSAMAPlugin && ConfigBuilderPlugin.getActiveAPS().getLastAPSResult() != null && ConfigBuilderPlugin.getActiveAPS().getLastAPSRun().after(new Date(new Date().getTime() - 11 * 60 * 1000L))) {
|
||||
if (ConfigBuilderPlugin.getActiveAPS() instanceof OpenAPSAMAPlugin && ConfigBuilderPlugin.getActiveAPS().getLastAPSResult() != null && ConfigBuilderPlugin.getActiveAPS().getLastAPSRun().after(new Date(System.currentTimeMillis() - 11 * 60 * 1000L))) {
|
||||
cobLayout.setVisibility(View.VISIBLE);
|
||||
cobAvailable = true;
|
||||
} else {
|
||||
|
@ -317,7 +317,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
|
|||
if (useSuperBolus) {
|
||||
final LoopPlugin activeloop = MainApp.getConfigBuilder().getActiveLoop();
|
||||
if (activeloop != null) {
|
||||
activeloop.superBolusTo(new Date().getTime() + 2 * 60L * 60 * 1000);
|
||||
activeloop.superBolusTo(System.currentTimeMillis() + 2 * 60L * 60 * 1000);
|
||||
MainApp.bus().post(new EventRefreshGui(false));
|
||||
}
|
||||
result = pump.setTempBasalAbsolute(0d, 120);
|
||||
|
@ -422,7 +422,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
|
|||
wizardDialogDeliverButton.setVisibility(Button.INVISIBLE);
|
||||
|
||||
// COB only if AMA is selected
|
||||
if (ConfigBuilderPlugin.getActiveAPS() instanceof OpenAPSAMAPlugin && ConfigBuilderPlugin.getActiveAPS().getLastAPSResult() != null && ConfigBuilderPlugin.getActiveAPS().getLastAPSRun().after(new Date(new Date().getTime() - 11 * 60 * 1000L))) {
|
||||
if (ConfigBuilderPlugin.getActiveAPS() instanceof OpenAPSAMAPlugin && ConfigBuilderPlugin.getActiveAPS().getLastAPSResult() != null && ConfigBuilderPlugin.getActiveAPS().getLastAPSRun().after(new Date(System.currentTimeMillis() - 11 * 60 * 1000L))) {
|
||||
cobLayout.setVisibility(View.VISIBLE);
|
||||
cobAvailable = true;
|
||||
} else {
|
||||
|
@ -466,7 +466,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
|
|||
// COB
|
||||
Double c_cob = 0d;
|
||||
if (cobAvailable && cobCheckbox.isChecked()) {
|
||||
if (ConfigBuilderPlugin.getActiveAPS().getLastAPSResult() != null && ConfigBuilderPlugin.getActiveAPS().getLastAPSRun().after(new Date(new Date().getTime() - 11 * 60 * 1000L))) {
|
||||
if (ConfigBuilderPlugin.getActiveAPS().getLastAPSResult() != null && ConfigBuilderPlugin.getActiveAPS().getLastAPSRun().after(new Date(System.currentTimeMillis() - 11 * 60 * 1000L))) {
|
||||
try {
|
||||
c_cob = SafeParse.stringToDouble(ConfigBuilderPlugin.getActiveAPS().getLastAPSResult().json().getString("COB"));
|
||||
} catch (JSONException e) {
|
||||
|
|
|
@ -61,7 +61,7 @@ public class Notification {
|
|||
this.date = new Date();
|
||||
this.text = text;
|
||||
this.level = level;
|
||||
this.validTo = new Date(new Date().getTime() + validMinutes * 60 * 1000L);
|
||||
this.validTo = new Date(System.currentTimeMillis() + validMinutes * 60 * 1000L);
|
||||
}
|
||||
|
||||
public Notification(int id, String text, int level) {
|
||||
|
@ -81,7 +81,7 @@ public class Notification {
|
|||
this.id = NSANNOUNCEMENT;
|
||||
this.level = ANNOUNCEMENT;
|
||||
this.text = nsAlarm.getMessage();
|
||||
this.validTo = new Date(new Date().getTime() + 60 * 60 * 1000L);
|
||||
this.validTo = new Date(System.currentTimeMillis() + 60 * 60 * 1000L);
|
||||
break;
|
||||
case 1:
|
||||
this.id = NSALARM;
|
||||
|
|
|
@ -57,7 +57,7 @@ public class NotificationStore {
|
|||
public void removeExpired() {
|
||||
for (int i = 0; i < store.size(); i++) {
|
||||
Notification n = get(i);
|
||||
if (n.validTo.getTime() != 0 && n.validTo.getTime() < new Date().getTime()) {
|
||||
if (n.validTo.getTime() != 0 && n.validTo.getTime() < System.currentTimeMillis()) {
|
||||
store.remove(i);
|
||||
i--;
|
||||
}
|
||||
|
|
|
@ -430,7 +430,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
NSUpload.uploadOpenAPSOffline(0);
|
||||
return true;
|
||||
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.suspendloopfor1h))) {
|
||||
activeloop.suspendTo(new Date().getTime() + 60L * 60 * 1000);
|
||||
activeloop.suspendTo(System.currentTimeMillis() + 60L * 60 * 1000);
|
||||
updateGUI("suspendmenu");
|
||||
sHandler.post(new Runnable() {
|
||||
@Override
|
||||
|
@ -444,7 +444,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
NSUpload.uploadOpenAPSOffline(60);
|
||||
return true;
|
||||
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.suspendloopfor2h))) {
|
||||
activeloop.suspendTo(new Date().getTime() + 2 * 60L * 60 * 1000);
|
||||
activeloop.suspendTo(System.currentTimeMillis() + 2 * 60L * 60 * 1000);
|
||||
updateGUI("suspendmenu");
|
||||
sHandler.post(new Runnable() {
|
||||
@Override
|
||||
|
@ -458,7 +458,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
NSUpload.uploadOpenAPSOffline(120);
|
||||
return true;
|
||||
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.suspendloopfor3h))) {
|
||||
activeloop.suspendTo(new Date().getTime() + 3 * 60L * 60 * 1000);
|
||||
activeloop.suspendTo(System.currentTimeMillis() + 3 * 60L * 60 * 1000);
|
||||
updateGUI("suspendmenu");
|
||||
sHandler.post(new Runnable() {
|
||||
@Override
|
||||
|
@ -472,7 +472,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
NSUpload.uploadOpenAPSOffline(180);
|
||||
return true;
|
||||
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.suspendloopfor10h))) {
|
||||
activeloop.suspendTo(new Date().getTime() + 10 * 60L * 60 * 1000);
|
||||
activeloop.suspendTo(System.currentTimeMillis() + 10 * 60L * 60 * 1000);
|
||||
updateGUI("suspendmenu");
|
||||
sHandler.post(new Runnable() {
|
||||
@Override
|
||||
|
@ -486,7 +486,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
NSUpload.uploadOpenAPSOffline(600);
|
||||
return true;
|
||||
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.disconnectpumpfor30m))) {
|
||||
activeloop.suspendTo(new Date().getTime() + 30L * 60 * 1000);
|
||||
activeloop.suspendTo(System.currentTimeMillis() + 30L * 60 * 1000);
|
||||
updateGUI("suspendmenu");
|
||||
sHandler.post(new Runnable() {
|
||||
@Override
|
||||
|
@ -500,7 +500,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
NSUpload.uploadOpenAPSOffline(30);
|
||||
return true;
|
||||
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.disconnectpumpfor1h))) {
|
||||
activeloop.suspendTo(new Date().getTime() + 1 * 60L * 60 * 1000);
|
||||
activeloop.suspendTo(System.currentTimeMillis() + 1 * 60L * 60 * 1000);
|
||||
updateGUI("suspendmenu");
|
||||
sHandler.post(new Runnable() {
|
||||
@Override
|
||||
|
@ -514,7 +514,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
NSUpload.uploadOpenAPSOffline(60);
|
||||
return true;
|
||||
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.disconnectpumpfor2h))) {
|
||||
activeloop.suspendTo(new Date().getTime() + 2 * 60L * 60 * 1000);
|
||||
activeloop.suspendTo(System.currentTimeMillis() + 2 * 60L * 60 * 1000);
|
||||
updateGUI("suspendmenu");
|
||||
sHandler.post(new Runnable() {
|
||||
@Override
|
||||
|
@ -528,7 +528,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
NSUpload.uploadOpenAPSOffline(120);
|
||||
return true;
|
||||
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.disconnectpumpfor3h))) {
|
||||
activeloop.suspendTo(new Date().getTime() + 3 * 60L * 60 * 1000);
|
||||
activeloop.suspendTo(System.currentTimeMillis() + 3 * 60L * 60 * 1000);
|
||||
updateGUI("suspendmenu");
|
||||
sHandler.post(new Runnable() {
|
||||
@Override
|
||||
|
@ -953,7 +953,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
}
|
||||
|
||||
// temp target
|
||||
TempTarget tempTarget = MainApp.getConfigBuilder().getTempTargetFromHistory(new Date().getTime());
|
||||
TempTarget tempTarget = MainApp.getConfigBuilder().getTempTargetFromHistory(System.currentTimeMillis());
|
||||
if (tempTarget != null) {
|
||||
tempTargetView.setTextColor(Color.BLACK);
|
||||
tempTargetView.setBackgroundColor(MainApp.sResources.getColor(R.color.tempTargetBackground));
|
||||
|
@ -998,7 +998,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
calibrationButton.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
TemporaryBasal activeTemp = MainApp.getConfigBuilder().getTempBasalFromHistory(new Date().getTime());
|
||||
TemporaryBasal activeTemp = MainApp.getConfigBuilder().getTempBasalFromHistory(System.currentTimeMillis());
|
||||
if (activeTemp != null) {
|
||||
cancelTempButton.setVisibility(View.VISIBLE);
|
||||
cancelTempButton.setText(MainApp.instance().getString(R.string.cancel) + "\n" + activeTemp.toStringShort());
|
||||
|
@ -1017,7 +1017,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
}
|
||||
baseBasalView.setText(basalText);
|
||||
|
||||
ExtendedBolus extendedBolus = MainApp.getConfigBuilder().getExtendedBolusFromHistory(new Date().getTime());
|
||||
ExtendedBolus extendedBolus = MainApp.getConfigBuilder().getExtendedBolusFromHistory(System.currentTimeMillis());
|
||||
String extendedBolusText = "";
|
||||
if (extendedBolus != null && !pump.isFakingTempsByExtendedBoluses()) {
|
||||
extendedBolusText = extendedBolus.toString();
|
||||
|
@ -1121,7 +1121,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
flag &= ~Paint.STRIKE_THRU_TEXT_FLAG;
|
||||
bgView.setPaintFlags(flag);
|
||||
|
||||
Long agoMsec = new Date().getTime() - lastBG.date;
|
||||
Long agoMsec = System.currentTimeMillis() - lastBG.date;
|
||||
int agoMin = (int) (agoMsec / 60d / 1000d);
|
||||
timeAgoView.setText(String.format(MainApp.sResources.getString(R.string.minago), agoMin));
|
||||
|
||||
|
@ -1139,7 +1139,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
// cob
|
||||
if (cobView != null) { // view must not exists
|
||||
String cobText = "";
|
||||
AutosensData autosensData = IobCobCalculatorPlugin.getAutosensData(new Date().getTime());
|
||||
AutosensData autosensData = IobCobCalculatorPlugin.getAutosensData(System.currentTimeMillis());
|
||||
if (autosensData != null)
|
||||
cobText = (int) autosensData.cob + " g " + String.format(MainApp.sResources.getString(R.string.minago), autosensData.minOld());
|
||||
cobView.setText(cobText);
|
||||
|
@ -1159,7 +1159,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
|
||||
// allign to hours
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(new Date().getTime());
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
calendar.set(Calendar.MILLISECOND, 0);
|
||||
calendar.set(Calendar.SECOND, 0);
|
||||
calendar.set(Calendar.MINUTE, 0);
|
||||
|
@ -1170,7 +1170,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
long fromTime;
|
||||
long endTime;
|
||||
if (showPrediction) {
|
||||
int predHours = (int) (Math.ceil(((DetermineBasalResultAMA) finalLastRun.constraintsProcessed).getLatestPredictionsTime() - new Date().getTime()) / (60 * 60 * 1000));
|
||||
int predHours = (int) (Math.ceil(((DetermineBasalResultAMA) finalLastRun.constraintsProcessed).getLatestPredictionsTime() - System.currentTimeMillis()) / (60 * 60 * 1000));
|
||||
predHours = Math.min(2, predHours);
|
||||
predHours = Math.max(0, predHours);
|
||||
hoursToFetch = rangeToDisplay - predHours;
|
||||
|
@ -1194,7 +1194,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
// **** TEMP BASALS graph ****
|
||||
Double maxBasalValueFound = 0d;
|
||||
|
||||
long now = new Date().getTime();
|
||||
long now = System.currentTimeMillis();
|
||||
if (pump.getPumpDescription().isTempBasalCapable && showBasalsView.isChecked()) {
|
||||
List<DataPoint> baseBasalArray = new ArrayList<>();
|
||||
List<DataPoint> tempBasalArray = new ArrayList<>();
|
||||
|
|
|
@ -139,7 +139,7 @@ public class PersistentNotificationPlugin implements PluginBase {
|
|||
PumpInterface pump = MainApp.getConfigBuilder();
|
||||
|
||||
if (MainApp.getConfigBuilder().isTempBasalInProgress()) {
|
||||
TemporaryBasal activeTemp = MainApp.getConfigBuilder().getTempBasalFromHistory(new Date().getTime());
|
||||
TemporaryBasal activeTemp = MainApp.getConfigBuilder().getTempBasalFromHistory(System.currentTimeMillis());
|
||||
line1 += " " + activeTemp.toStringShort();
|
||||
}
|
||||
|
||||
|
|
|
@ -213,13 +213,13 @@ public class DanaRFragment extends Fragment {
|
|||
public void run() {
|
||||
DanaRPump pump = DanaRPump.getInstance();
|
||||
if (pump.lastConnection.getTime() != 0) {
|
||||
Long agoMsec = new Date().getTime() - pump.lastConnection.getTime();
|
||||
Long agoMsec = System.currentTimeMillis() - pump.lastConnection.getTime();
|
||||
int agoMin = (int) (agoMsec / 60d / 1000d);
|
||||
lastConnectionView.setText(DateUtil.timeString(pump.lastConnection) + " (" + String.format(MainApp.sResources.getString(R.string.minago), agoMin) + ")");
|
||||
SetWarnColor.setColor(lastConnectionView, agoMin, 16d, 31d);
|
||||
}
|
||||
if (pump.lastBolusTime.getTime() != 0) {
|
||||
Long agoMsec = new Date().getTime() - pump.lastBolusTime.getTime();
|
||||
Long agoMsec = System.currentTimeMillis() - pump.lastBolusTime.getTime();
|
||||
double agoHours = agoMsec / 60d / 60d / 1000d;
|
||||
if (agoHours < 6) // max 6h back
|
||||
lastBolusView.setText(DateUtil.timeString(pump.lastBolusTime) + " (" + DecimalFormatter.to1Decimal(agoHours) + " " + MainApp.sResources.getString(R.string.hoursago) + ") " + DecimalFormatter.to2Decimal(DanaRPump.getInstance().lastBolusAmount) + " U");
|
||||
|
@ -230,12 +230,12 @@ public class DanaRFragment extends Fragment {
|
|||
SetWarnColor.setColor(dailyUnitsView, pump.dailyTotalUnits, pump.maxDailyTotalUnits * 0.75d, pump.maxDailyTotalUnits * 0.9d);
|
||||
basaBasalRateView.setText("( " + (pump.activeProfile + 1) + " ) " + DecimalFormatter.to2Decimal(getPlugin().getBaseBasalRate()) + " U/h");
|
||||
if (MainApp.getConfigBuilder().isInHistoryRealTempBasalInProgress()) {
|
||||
tempBasalView.setText(MainApp.getConfigBuilder().getRealTempBasalFromHistory(new Date().getTime()).toStringFull());
|
||||
tempBasalView.setText(MainApp.getConfigBuilder().getRealTempBasalFromHistory(System.currentTimeMillis()).toStringFull());
|
||||
} else {
|
||||
tempBasalView.setText("");
|
||||
}
|
||||
if (MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress()) {
|
||||
extendedBolusView.setText(MainApp.getConfigBuilder().getExtendedBolusFromHistory(new Date().getTime()).toString());
|
||||
extendedBolusView.setText(MainApp.getConfigBuilder().getExtendedBolusFromHistory(System.currentTimeMillis()).toString());
|
||||
} else {
|
||||
extendedBolusView.setText("");
|
||||
}
|
||||
|
|
|
@ -309,7 +309,7 @@ public class DanaRPlugin implements PluginBase, PumpInterface, DanaRInterface, C
|
|||
if (Config.logPumpActions)
|
||||
log.debug("deliverTreatment: OK. Asked: " + detailedBolusInfo.insulin + " Delivered: " + result.bolusDelivered);
|
||||
detailedBolusInfo.insulin = t.insulin;
|
||||
detailedBolusInfo.date = new Date().getTime();
|
||||
detailedBolusInfo.date = System.currentTimeMillis();
|
||||
MainApp.getConfigBuilder().addToHistoryTreatment(detailedBolusInfo);
|
||||
return result;
|
||||
} else {
|
||||
|
@ -336,7 +336,7 @@ public class DanaRPlugin implements PluginBase, PumpInterface, DanaRInterface, C
|
|||
@Override
|
||||
public PumpEnactResult setTempBasalAbsolute(Double absoluteRate, Integer durationInMinutes) {
|
||||
// Recheck pump status if older than 30 min
|
||||
if (pump.lastConnection.getTime() + 30 * 60 * 1000L < new Date().getTime()) {
|
||||
if (pump.lastConnection.getTime() + 30 * 60 * 1000L < System.currentTimeMillis()) {
|
||||
doConnect("setTempBasalAbsolute old data");
|
||||
}
|
||||
|
||||
|
@ -393,7 +393,7 @@ public class DanaRPlugin implements PluginBase, PumpInterface, DanaRInterface, C
|
|||
// Check if some temp is already in progress
|
||||
if (MainApp.getConfigBuilder().isInHistoryRealTempBasalInProgress()) {
|
||||
// Correct basal already set ?
|
||||
if (MainApp.getConfigBuilder().getRealTempBasalFromHistory(new Date().getTime()).percentRate == percentRate) {
|
||||
if (MainApp.getConfigBuilder().getRealTempBasalFromHistory(System.currentTimeMillis()).percentRate == percentRate) {
|
||||
result.success = true;
|
||||
result.percent = percentRate;
|
||||
result.absolute = MainApp.getConfigBuilder().getTempBasalAbsoluteRateHistory();
|
||||
|
@ -644,7 +644,7 @@ public class DanaRPlugin implements PluginBase, PumpInterface, DanaRInterface, C
|
|||
|
||||
@Override
|
||||
public JSONObject getJSONStatus() {
|
||||
if (pump.lastConnection.getTime() + 5 * 60 * 1000L < new Date().getTime()) {
|
||||
if (pump.lastConnection.getTime() + 5 * 60 * 1000L < System.currentTimeMillis()) {
|
||||
return null;
|
||||
}
|
||||
JSONObject pumpjson = new JSONObject();
|
||||
|
@ -661,13 +661,13 @@ public class DanaRPlugin implements PluginBase, PumpInterface, DanaRInterface, C
|
|||
extended.put("LastBolus", pump.lastBolusTime.toLocaleString());
|
||||
extended.put("LastBolusAmount", pump.lastBolusAmount);
|
||||
}
|
||||
TemporaryBasal tb = MainApp.getConfigBuilder().getRealTempBasalFromHistory(new Date().getTime());
|
||||
TemporaryBasal tb = MainApp.getConfigBuilder().getRealTempBasalFromHistory(System.currentTimeMillis());
|
||||
if (tb != null) {
|
||||
extended.put("TempBasalAbsoluteRate", tb.tempBasalConvertedToAbsolute(new Date().getTime()));
|
||||
extended.put("TempBasalAbsoluteRate", tb.tempBasalConvertedToAbsolute(System.currentTimeMillis()));
|
||||
extended.put("TempBasalStart", DateUtil.dateAndTimeString(tb.date));
|
||||
extended.put("TempBasalRemaining", tb.getPlannedRemainingMinutes());
|
||||
}
|
||||
ExtendedBolus eb = MainApp.getConfigBuilder().getExtendedBolusFromHistory(new Date().getTime());
|
||||
ExtendedBolus eb = MainApp.getConfigBuilder().getExtendedBolusFromHistory(System.currentTimeMillis());
|
||||
if (eb != null) {
|
||||
extended.put("ExtendedBolusAbsoluteRate", eb.absoluteRate());
|
||||
extended.put("ExtendedBolusStart", DateUtil.dateAndTimeString(eb.date));
|
||||
|
@ -805,7 +805,7 @@ public class DanaRPlugin implements PluginBase, PumpInterface, DanaRInterface, C
|
|||
public String shortStatus(boolean veryShort) {
|
||||
String ret = "";
|
||||
if (pump.lastConnection.getTime() != 0) {
|
||||
Long agoMsec = new Date().getTime() - pump.lastConnection.getTime();
|
||||
Long agoMsec = System.currentTimeMillis() - pump.lastConnection.getTime();
|
||||
int agoMin = (int) (agoMsec / 60d / 1000d);
|
||||
ret += "LastConn: " + agoMin + " minago\n";
|
||||
}
|
||||
|
@ -813,10 +813,10 @@ public class DanaRPlugin implements PluginBase, PumpInterface, DanaRInterface, C
|
|||
ret += "LastBolus: " + DecimalFormatter.to2Decimal(pump.lastBolusAmount) + "U @" + android.text.format.DateFormat.format("HH:mm", pump.lastBolusTime) + "\n";
|
||||
}
|
||||
if (MainApp.getConfigBuilder().isInHistoryRealTempBasalInProgress()) {
|
||||
ret += "Temp: " + MainApp.getConfigBuilder().getRealTempBasalFromHistory(new Date().getTime()).toStringFull() + "\n";
|
||||
ret += "Temp: " + MainApp.getConfigBuilder().getRealTempBasalFromHistory(System.currentTimeMillis()).toStringFull() + "\n";
|
||||
}
|
||||
if (MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress()) {
|
||||
ret += "Extended: " + MainApp.getConfigBuilder().getExtendedBolusFromHistory(new Date().getTime()).toString() + "\n";
|
||||
ret += "Extended: " + MainApp.getConfigBuilder().getExtendedBolusFromHistory(System.currentTimeMillis()).toString() + "\n";
|
||||
}
|
||||
if (!veryShort) {
|
||||
ret += "TDD: " + DecimalFormatter.to0Decimal(pump.dailyTotalUnits) + " / " + pump.maxDailyTotalUnits + " U\n";
|
||||
|
|
|
@ -30,13 +30,13 @@ public class MsgBolusProgress extends MessageBase {
|
|||
this();
|
||||
this.amount = amount;
|
||||
this.t = t;
|
||||
lastReceive = new Date().getTime();
|
||||
lastReceive = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(byte[] bytes) {
|
||||
progress = intFromBuff(bytes, 0, 2);
|
||||
lastReceive = new Date().getTime();
|
||||
lastReceive = System.currentTimeMillis();
|
||||
Double done = (amount * 100 - progress) / 100d;
|
||||
t.insulin = done;
|
||||
EventOverviewBolusProgress bolusingEvent = EventOverviewBolusProgress.getInstance();
|
||||
|
|
|
@ -61,16 +61,16 @@ public class MsgStatusBolusExtended extends MessageBase {
|
|||
|
||||
@NonNull
|
||||
private Date getDateFromSecAgo(int tempBasalAgoSecs) {
|
||||
return new Date((long) (Math.ceil(new Date().getTime() / 1000d) - tempBasalAgoSecs) * 1000);
|
||||
return new Date((long) (Math.ceil(System.currentTimeMillis() / 1000d) - tempBasalAgoSecs) * 1000);
|
||||
}
|
||||
|
||||
public static void updateExtendedBolusInDB() {
|
||||
TreatmentsInterface treatmentsInterface = MainApp.getConfigBuilder();
|
||||
DanaRPump pump = DanaRPump.getInstance();
|
||||
long now = new Date().getTime();
|
||||
long now = System.currentTimeMillis();
|
||||
|
||||
if (treatmentsInterface.isInHistoryExtendedBoluslInProgress()) {
|
||||
ExtendedBolus extendedBolus = treatmentsInterface.getExtendedBolusFromHistory(new Date().getTime());
|
||||
ExtendedBolus extendedBolus = treatmentsInterface.getExtendedBolusFromHistory(System.currentTimeMillis());
|
||||
if (pump.isExtendedInProgress) {
|
||||
if (extendedBolus.absoluteRate() != pump.extendedBolusAbsoluteRate) {
|
||||
// Close current extended
|
||||
|
|
|
@ -55,16 +55,16 @@ public class MsgStatusTempBasal extends MessageBase {
|
|||
|
||||
@NonNull
|
||||
private Date getDateFromTempBasalSecAgo(int tempBasalAgoSecs) {
|
||||
return new Date((long) (Math.ceil(new Date().getTime() / 1000d) - tempBasalAgoSecs) * 1000);
|
||||
return new Date((long) (Math.ceil(System.currentTimeMillis() / 1000d) - tempBasalAgoSecs) * 1000);
|
||||
}
|
||||
|
||||
public static void updateTempBasalInDB() {
|
||||
TreatmentsInterface treatmentsInterface = MainApp.getConfigBuilder();
|
||||
DanaRPump danaRPump = DanaRPump.getInstance();
|
||||
long now = new Date().getTime();
|
||||
long now = System.currentTimeMillis();
|
||||
|
||||
if (treatmentsInterface.isInHistoryRealTempBasalInProgress()) {
|
||||
TemporaryBasal tempBasal = treatmentsInterface.getRealTempBasalFromHistory(new Date().getTime());
|
||||
TemporaryBasal tempBasal = treatmentsInterface.getRealTempBasalFromHistory(System.currentTimeMillis());
|
||||
if (danaRPump.isTempBasalInProgress) {
|
||||
if (tempBasal.percentRate != danaRPump.tempBasalPercent) {
|
||||
// Close current temp basal
|
||||
|
|
|
@ -200,9 +200,9 @@ public class DanaRExecutionService extends Service {
|
|||
getBTSocketForSelectedPump();
|
||||
if (mRfcommSocket == null || mBTDevice == null)
|
||||
return; // Device not found
|
||||
long startTime = new Date().getTime();
|
||||
while (!isConnected() && startTime + maxConnectionTime >= new Date().getTime()) {
|
||||
long secondsElapsed = (new Date().getTime() - startTime) / 1000L;
|
||||
long startTime = System.currentTimeMillis();
|
||||
while (!isConnected() && startTime + maxConnectionTime >= System.currentTimeMillis()) {
|
||||
long secondsElapsed = (System.currentTimeMillis() - startTime) / 1000L;
|
||||
MainApp.bus().post(new EventPumpStatusChanged(EventPumpStatusChanged.CONNECTING, (int) secondsElapsed));
|
||||
if (Config.logDanaBTComm)
|
||||
log.debug("connect waiting " + secondsElapsed + "sec from: " + from);
|
||||
|
@ -229,7 +229,7 @@ public class DanaRExecutionService extends Service {
|
|||
if (!MainApp.getSpecificPlugin(DanaRPlugin.class).isEnabled(PluginBase.PUMP))
|
||||
return;
|
||||
getBTSocketForSelectedPump();
|
||||
startTime = new Date().getTime();
|
||||
startTime = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -404,12 +404,12 @@ public class DanaRExecutionService extends Service {
|
|||
if (!isConnected()) return false;
|
||||
|
||||
if (carbs > 0) {
|
||||
mSerialIOThread.sendMessage(new MsgSetCarbsEntry(new Date().getTime(), carbs));
|
||||
mSerialIOThread.sendMessage(new MsgSetCarbsEntry(System.currentTimeMillis(), carbs));
|
||||
}
|
||||
|
||||
MsgBolusProgress progress = new MsgBolusProgress(amount, t); // initialize static variables
|
||||
MainApp.bus().post(new EventDanaRBolusStart());
|
||||
long startTime = new Date().getTime();
|
||||
long startTime = System.currentTimeMillis();
|
||||
|
||||
if (!stop.stopped) {
|
||||
mSerialIOThread.sendMessage(start);
|
||||
|
@ -419,7 +419,7 @@ public class DanaRExecutionService extends Service {
|
|||
}
|
||||
while (!stop.stopped && !start.failed) {
|
||||
waitMsec(100);
|
||||
if ((new Date().getTime() - progress.lastReceive) > 5 * 1000L) { // if i didn't receive status for more than 5 sec expecting broken comm
|
||||
if ((System.currentTimeMillis() - progress.lastReceive) > 5 * 1000L) { // if i didn't receive status for more than 5 sec expecting broken comm
|
||||
stop.stopped = true;
|
||||
stop.forced = true;
|
||||
log.debug("Communication stopped");
|
||||
|
@ -430,7 +430,7 @@ public class DanaRExecutionService extends Service {
|
|||
// try to find real amount if bolusing was interrupted or comm failed
|
||||
if (t.insulin != amount) {
|
||||
disconnect("bolusingInterrupted");
|
||||
long now = new Date().getTime();
|
||||
long now = System.currentTimeMillis();
|
||||
long estimatedBolusEnd = (long) (startTime + amount / 5d * 60 * 1000); // std delivery rate 5 U/min
|
||||
waitMsec(Math.max(5000, estimatedBolusEnd - now + 3000));
|
||||
connect("bolusingInterrupted");
|
||||
|
@ -466,7 +466,7 @@ public class DanaRExecutionService extends Service {
|
|||
public boolean carbsEntry(int amount) {
|
||||
connect("carbsEntry");
|
||||
if (!isConnected()) return false;
|
||||
MsgSetCarbsEntry msg = new MsgSetCarbsEntry(new Date().getTime(), amount);
|
||||
MsgSetCarbsEntry msg = new MsgSetCarbsEntry(System.currentTimeMillis(), amount);
|
||||
mSerialIOThread.sendMessage(msg);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -212,13 +212,13 @@ public class DanaRKoreanFragment extends Fragment {
|
|||
public void run() {
|
||||
DanaRPump pump = DanaRPump.getInstance();
|
||||
if (pump.lastConnection.getTime() != 0) {
|
||||
Long agoMsec = new Date().getTime() - pump.lastConnection.getTime();
|
||||
Long agoMsec = System.currentTimeMillis() - pump.lastConnection.getTime();
|
||||
int agoMin = (int) (agoMsec / 60d / 1000d);
|
||||
lastConnectionView.setText(DateUtil.timeString(pump.lastConnection) + " (" + String.format(MainApp.sResources.getString(R.string.minago), agoMin) + ")");
|
||||
SetWarnColor.setColor(lastConnectionView, agoMin, 16d, 31d);
|
||||
}
|
||||
// if (pump.lastBolusTime.getTime() != 0) {
|
||||
// Long agoMsec = new Date().getTime() - pump.lastBolusTime.getTime();
|
||||
// Long agoMsec = System.currentTimeMillis() - pump.lastBolusTime.getTime();
|
||||
// double agoHours = agoMsec / 60d / 60d / 1000d;
|
||||
// if (agoHours < 6) // max 6h back
|
||||
// lastBolusView.setText(formatTime.format(pump.lastBolusTime) + " (" + DecimalFormatter.to1Decimal(agoHours) + " " + getString(R.string.hoursago) + ") " + DecimalFormatter.to2Decimal(pump.lastBolusAmount) + " U");
|
||||
|
@ -229,12 +229,12 @@ public class DanaRKoreanFragment extends Fragment {
|
|||
SetWarnColor.setColor(dailyUnitsView, pump.dailyTotalUnits, pump.maxDailyTotalUnits * 0.75d, pump.maxDailyTotalUnits * 0.9d);
|
||||
basaBasalRateView.setText("( " + (pump.activeProfile + 1) + " ) " + DecimalFormatter.to2Decimal(danaRKoreanPlugin.getBaseBasalRate()) + " U/h");
|
||||
if (MainApp.getConfigBuilder().isInHistoryRealTempBasalInProgress()) {
|
||||
tempBasalView.setText(MainApp.getConfigBuilder().getRealTempBasalFromHistory(new Date().getTime()).toStringFull());
|
||||
tempBasalView.setText(MainApp.getConfigBuilder().getRealTempBasalFromHistory(System.currentTimeMillis()).toStringFull());
|
||||
} else {
|
||||
tempBasalView.setText("");
|
||||
}
|
||||
if (MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress()) {
|
||||
extendedBolusView.setText(MainApp.getConfigBuilder().getExtendedBolusFromHistory(new Date().getTime()).toString());
|
||||
extendedBolusView.setText(MainApp.getConfigBuilder().getExtendedBolusFromHistory(System.currentTimeMillis()).toString());
|
||||
} else {
|
||||
extendedBolusView.setText("");
|
||||
}
|
||||
|
|
|
@ -313,7 +313,7 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, DanaRInterf
|
|||
if (Config.logPumpActions)
|
||||
log.debug("deliverTreatment: OK. Asked: " + detailedBolusInfo.insulin + " Delivered: " + result.bolusDelivered);
|
||||
detailedBolusInfo.insulin = t.insulin;
|
||||
detailedBolusInfo.date = new Date().getTime();
|
||||
detailedBolusInfo.date = System.currentTimeMillis();
|
||||
MainApp.getConfigBuilder().addToHistoryTreatment(detailedBolusInfo);
|
||||
return result;
|
||||
} else {
|
||||
|
@ -340,7 +340,7 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, DanaRInterf
|
|||
@Override
|
||||
public PumpEnactResult setTempBasalAbsolute(Double absoluteRate, Integer durationInMinutes) {
|
||||
// Recheck pump status if older than 30 min
|
||||
if (pump.lastConnection.getTime() + 30 * 60 * 1000L < new Date().getTime()) {
|
||||
if (pump.lastConnection.getTime() + 30 * 60 * 1000L < System.currentTimeMillis()) {
|
||||
doConnect("setTempBasalAbsolute old data");
|
||||
}
|
||||
|
||||
|
@ -397,7 +397,7 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, DanaRInterf
|
|||
// Check if some temp is already in progress
|
||||
if (MainApp.getConfigBuilder().isInHistoryRealTempBasalInProgress()) {
|
||||
// Correct basal already set ?
|
||||
if (MainApp.getConfigBuilder().getRealTempBasalFromHistory(new Date().getTime()).percentRate == percentRate) {
|
||||
if (MainApp.getConfigBuilder().getRealTempBasalFromHistory(System.currentTimeMillis()).percentRate == percentRate) {
|
||||
result.success = true;
|
||||
result.percent = percentRate;
|
||||
result.absolute = MainApp.getConfigBuilder().getTempBasalAbsoluteRateHistory();
|
||||
|
@ -648,7 +648,7 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, DanaRInterf
|
|||
|
||||
@Override
|
||||
public JSONObject getJSONStatus() {
|
||||
if (pump.lastConnection.getTime() + 5 * 60 * 1000L < new Date().getTime()) {
|
||||
if (pump.lastConnection.getTime() + 5 * 60 * 1000L < System.currentTimeMillis()) {
|
||||
return null;
|
||||
}
|
||||
JSONObject pumpjson = new JSONObject();
|
||||
|
@ -665,13 +665,13 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, DanaRInterf
|
|||
extended.put("LastBolus", pump.lastBolusTime.toLocaleString());
|
||||
extended.put("LastBolusAmount", pump.lastBolusAmount);
|
||||
}
|
||||
TemporaryBasal tb = MainApp.getConfigBuilder().getRealTempBasalFromHistory(new Date().getTime());
|
||||
TemporaryBasal tb = MainApp.getConfigBuilder().getRealTempBasalFromHistory(System.currentTimeMillis());
|
||||
if (tb != null) {
|
||||
extended.put("TempBasalAbsoluteRate", tb.tempBasalConvertedToAbsolute(new Date().getTime()));
|
||||
extended.put("TempBasalAbsoluteRate", tb.tempBasalConvertedToAbsolute(System.currentTimeMillis()));
|
||||
extended.put("TempBasalStart", DateUtil.dateAndTimeString(tb.date));
|
||||
extended.put("TempBasalRemaining", tb.getPlannedRemainingMinutes());
|
||||
}
|
||||
ExtendedBolus eb = MainApp.getConfigBuilder().getExtendedBolusFromHistory(new Date().getTime());
|
||||
ExtendedBolus eb = MainApp.getConfigBuilder().getExtendedBolusFromHistory(System.currentTimeMillis());
|
||||
if (eb != null) {
|
||||
extended.put("ExtendedBolusAbsoluteRate", eb.absoluteRate());
|
||||
extended.put("ExtendedBolusStart", DateUtil.dateAndTimeString(eb.date));
|
||||
|
@ -809,7 +809,7 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, DanaRInterf
|
|||
public String shortStatus(boolean veryShort) {
|
||||
String ret = "";
|
||||
if (pump.lastConnection.getTime() != 0) {
|
||||
Long agoMsec = new Date().getTime() - pump.lastConnection.getTime();
|
||||
Long agoMsec = System.currentTimeMillis() - pump.lastConnection.getTime();
|
||||
int agoMin = (int) (agoMsec / 60d / 1000d);
|
||||
ret += "LastConn: " + agoMin + " minago\n";
|
||||
}
|
||||
|
@ -817,10 +817,10 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, DanaRInterf
|
|||
ret += "LastBolus: " + DecimalFormatter.to2Decimal(pump.lastBolusAmount) + "U @" + android.text.format.DateFormat.format("HH:mm", pump.lastBolusTime) + "\n";
|
||||
}
|
||||
if (MainApp.getConfigBuilder().isInHistoryRealTempBasalInProgress()) {
|
||||
ret += "Temp: " + MainApp.getConfigBuilder().getRealTempBasalFromHistory(new Date().getTime()).toStringFull() + "\n";
|
||||
ret += "Temp: " + MainApp.getConfigBuilder().getRealTempBasalFromHistory(System.currentTimeMillis()).toStringFull() + "\n";
|
||||
}
|
||||
if (MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress()) {
|
||||
ret += "Extended: " + MainApp.getConfigBuilder().getExtendedBolusFromHistory(new Date().getTime()).toString() + "\n";
|
||||
ret += "Extended: " + MainApp.getConfigBuilder().getExtendedBolusFromHistory(System.currentTimeMillis()).toString() + "\n";
|
||||
}
|
||||
if (!veryShort) {
|
||||
ret += "TDD: " + DecimalFormatter.to0Decimal(pump.dailyTotalUnits) + " / " + pump.maxDailyTotalUnits + " U\n";
|
||||
|
|
|
@ -196,9 +196,9 @@ public class DanaRKoreanExecutionService extends Service {
|
|||
getBTSocketForSelectedPump();
|
||||
if (mRfcommSocket == null || mBTDevice == null)
|
||||
return; // Device not found
|
||||
long startTime = new Date().getTime();
|
||||
while (!isConnected() && startTime + maxConnectionTime >= new Date().getTime()) {
|
||||
long secondsElapsed = (new Date().getTime() - startTime) / 1000L;
|
||||
long startTime = System.currentTimeMillis();
|
||||
while (!isConnected() && startTime + maxConnectionTime >= System.currentTimeMillis()) {
|
||||
long secondsElapsed = (System.currentTimeMillis() - startTime) / 1000L;
|
||||
MainApp.bus().post(new EventPumpStatusChanged(EventPumpStatusChanged.CONNECTING, (int) secondsElapsed));
|
||||
if (Config.logDanaBTComm)
|
||||
log.debug("connect waiting " + secondsElapsed + "sec from: " + from);
|
||||
|
@ -225,7 +225,7 @@ public class DanaRKoreanExecutionService extends Service {
|
|||
if (!MainApp.getSpecificPlugin(DanaRKoreanPlugin.class).isEnabled(PluginBase.PUMP))
|
||||
return;
|
||||
getBTSocketForSelectedPump();
|
||||
startTime = new Date().getTime();
|
||||
startTime = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -398,7 +398,7 @@ public class DanaRKoreanExecutionService extends Service {
|
|||
if (!isConnected()) return false;
|
||||
|
||||
if (carbs > 0) {
|
||||
mSerialIOThread.sendMessage(new MsgSetCarbsEntry(new Date().getTime(), carbs));
|
||||
mSerialIOThread.sendMessage(new MsgSetCarbsEntry(System.currentTimeMillis(), carbs));
|
||||
}
|
||||
|
||||
MsgBolusProgress progress = new MsgBolusProgress(amount, t); // initialize static variables
|
||||
|
@ -412,7 +412,7 @@ public class DanaRKoreanExecutionService extends Service {
|
|||
}
|
||||
while (!stop.stopped && !start.failed) {
|
||||
waitMsec(100);
|
||||
if ((new Date().getTime() - progress.lastReceive) > 5 * 1000L) { // if i didn't receive status for more than 5 sec expecting broken comm
|
||||
if ((System.currentTimeMillis() - progress.lastReceive) > 5 * 1000L) { // if i didn't receive status for more than 5 sec expecting broken comm
|
||||
stop.stopped = true;
|
||||
stop.forced = true;
|
||||
log.debug("Communication stopped");
|
||||
|
@ -443,7 +443,7 @@ public class DanaRKoreanExecutionService extends Service {
|
|||
public boolean carbsEntry(int amount) {
|
||||
connect("carbsEntry");
|
||||
if (!isConnected()) return false;
|
||||
MsgSetCarbsEntry msg = new MsgSetCarbsEntry(new Date().getTime(), amount);
|
||||
MsgSetCarbsEntry msg = new MsgSetCarbsEntry(System.currentTimeMillis(), amount);
|
||||
mSerialIOThread.sendMessage(msg);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -210,13 +210,13 @@ public class DanaRv2Fragment extends Fragment {
|
|||
public void run() {
|
||||
DanaRPump pump = DanaRPump.getInstance();
|
||||
if (pump.lastConnection.getTime() != 0) {
|
||||
Long agoMsec = new Date().getTime() - pump.lastConnection.getTime();
|
||||
Long agoMsec = System.currentTimeMillis() - pump.lastConnection.getTime();
|
||||
int agoMin = (int) (agoMsec / 60d / 1000d);
|
||||
lastConnectionView.setText(DateUtil.timeString(pump.lastConnection) + " (" + String.format(MainApp.sResources.getString(R.string.minago), agoMin) + ")");
|
||||
SetWarnColor.setColor(lastConnectionView, agoMin, 16d, 31d);
|
||||
}
|
||||
if (pump.lastBolusTime.getTime() != 0) {
|
||||
Long agoMsec = new Date().getTime() - pump.lastBolusTime.getTime();
|
||||
Long agoMsec = System.currentTimeMillis() - pump.lastBolusTime.getTime();
|
||||
double agoHours = agoMsec / 60d / 60d / 1000d;
|
||||
if (agoHours < 6) // max 6h back
|
||||
lastBolusView.setText(DateUtil.timeString(pump.lastBolusTime) + " (" + DecimalFormatter.to1Decimal(agoHours) + " " + MainApp.sResources.getString(R.string.hoursago) + ") " + DecimalFormatter.to2Decimal(DanaRPump.getInstance().lastBolusAmount) + " U");
|
||||
|
@ -227,12 +227,12 @@ public class DanaRv2Fragment extends Fragment {
|
|||
SetWarnColor.setColor(dailyUnitsView, pump.dailyTotalUnits, pump.maxDailyTotalUnits * 0.75d, pump.maxDailyTotalUnits * 0.9d);
|
||||
basaBasalRateView.setText("( " + (pump.activeProfile + 1) + " ) " + DecimalFormatter.to2Decimal(getPlugin().getBaseBasalRate()) + " U/h");
|
||||
if (MainApp.getConfigBuilder().isTempBasalInProgress()) {
|
||||
tempBasalView.setText(MainApp.getConfigBuilder().getTempBasalFromHistory(new Date().getTime()).toStringFull());
|
||||
tempBasalView.setText(MainApp.getConfigBuilder().getTempBasalFromHistory(System.currentTimeMillis()).toStringFull());
|
||||
} else {
|
||||
tempBasalView.setText("");
|
||||
}
|
||||
if (MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress()) {
|
||||
extendedBolusView.setText(MainApp.getConfigBuilder().getExtendedBolusFromHistory(new Date().getTime()).toString());
|
||||
extendedBolusView.setText(MainApp.getConfigBuilder().getExtendedBolusFromHistory(System.currentTimeMillis()).toString());
|
||||
} else {
|
||||
extendedBolusView.setText("");
|
||||
}
|
||||
|
|
|
@ -289,7 +289,7 @@ public class DanaRv2Plugin implements PluginBase, PumpInterface, DanaRInterface,
|
|||
Treatment t = new Treatment(detailedBolusInfo.insulinInterface);
|
||||
boolean connectionOK = false;
|
||||
if (detailedBolusInfo.insulin > 0 || detailedBolusInfo.carbs > 0)
|
||||
connectionOK = sExecutionService.bolus(detailedBolusInfo.insulin, (int) detailedBolusInfo.carbs, new Date().getTime() + detailedBolusInfo.carbTime * 60 * 1000 + 1000, t); // +1000 to make the record different
|
||||
connectionOK = sExecutionService.bolus(detailedBolusInfo.insulin, (int) detailedBolusInfo.carbs, System.currentTimeMillis() + detailedBolusInfo.carbTime * 60 * 1000 + 1000, t); // +1000 to make the record different
|
||||
PumpEnactResult result = new PumpEnactResult();
|
||||
result.success = connectionOK;
|
||||
result.bolusDelivered = t.insulin;
|
||||
|
@ -322,7 +322,7 @@ public class DanaRv2Plugin implements PluginBase, PumpInterface, DanaRInterface,
|
|||
@Override
|
||||
public PumpEnactResult setTempBasalAbsolute(Double absoluteRate, Integer durationInMinutes) {
|
||||
// Recheck pump status if older than 30 min
|
||||
if (pump.lastConnection.getTime() + 30 * 60 * 1000L < new Date().getTime()) {
|
||||
if (pump.lastConnection.getTime() + 30 * 60 * 1000L < System.currentTimeMillis()) {
|
||||
doConnect("setTempBasalAbsolute old data");
|
||||
}
|
||||
|
||||
|
@ -361,7 +361,7 @@ public class DanaRv2Plugin implements PluginBase, PumpInterface, DanaRInterface,
|
|||
// Check if some temp is already in progress
|
||||
if (MainApp.getConfigBuilder().isTempBasalInProgress()) {
|
||||
// Correct basal already set ?
|
||||
if (MainApp.getConfigBuilder().getTempBasalFromHistory(new Date().getTime()).percentRate == percentRate) {
|
||||
if (MainApp.getConfigBuilder().getTempBasalFromHistory(System.currentTimeMillis()).percentRate == percentRate) {
|
||||
result.success = true;
|
||||
result.percent = percentRate;
|
||||
result.absolute = MainApp.getConfigBuilder().getTempBasalAbsoluteRateHistory();
|
||||
|
@ -570,7 +570,7 @@ public class DanaRv2Plugin implements PluginBase, PumpInterface, DanaRInterface,
|
|||
|
||||
@Override
|
||||
public JSONObject getJSONStatus() {
|
||||
if (pump.lastConnection.getTime() + 5 * 60 * 1000L < new Date().getTime()) {
|
||||
if (pump.lastConnection.getTime() + 5 * 60 * 1000L < System.currentTimeMillis()) {
|
||||
return null;
|
||||
}
|
||||
JSONObject pumpjson = new JSONObject();
|
||||
|
@ -587,13 +587,13 @@ public class DanaRv2Plugin implements PluginBase, PumpInterface, DanaRInterface,
|
|||
extended.put("LastBolus", pump.lastBolusTime.toLocaleString());
|
||||
extended.put("LastBolusAmount", pump.lastBolusAmount);
|
||||
}
|
||||
TemporaryBasal tb = MainApp.getConfigBuilder().getTempBasalFromHistory(new Date().getTime());
|
||||
TemporaryBasal tb = MainApp.getConfigBuilder().getTempBasalFromHistory(System.currentTimeMillis());
|
||||
if (tb != null) {
|
||||
extended.put("TempBasalAbsoluteRate", tb.tempBasalConvertedToAbsolute(new Date().getTime()));
|
||||
extended.put("TempBasalAbsoluteRate", tb.tempBasalConvertedToAbsolute(System.currentTimeMillis()));
|
||||
extended.put("TempBasalStart", DateUtil.dateAndTimeString(tb.date));
|
||||
extended.put("TempBasalRemaining", tb.getPlannedRemainingMinutes());
|
||||
}
|
||||
ExtendedBolus eb = MainApp.getConfigBuilder().getExtendedBolusFromHistory(new Date().getTime());
|
||||
ExtendedBolus eb = MainApp.getConfigBuilder().getExtendedBolusFromHistory(System.currentTimeMillis());
|
||||
if (eb != null) {
|
||||
extended.put("ExtendedBolusAbsoluteRate", eb.absoluteRate());
|
||||
extended.put("ExtendedBolusStart", DateUtil.dateAndTimeString(eb.date));
|
||||
|
@ -731,7 +731,7 @@ public class DanaRv2Plugin implements PluginBase, PumpInterface, DanaRInterface,
|
|||
public String shortStatus(boolean veryShort) {
|
||||
String ret = "";
|
||||
if (pump.lastConnection.getTime() != 0) {
|
||||
Long agoMsec = new Date().getTime() - pump.lastConnection.getTime();
|
||||
Long agoMsec = System.currentTimeMillis() - pump.lastConnection.getTime();
|
||||
int agoMin = (int) (agoMsec / 60d / 1000d);
|
||||
ret += "LastConn: " + agoMin + " minago\n";
|
||||
}
|
||||
|
@ -739,10 +739,10 @@ public class DanaRv2Plugin implements PluginBase, PumpInterface, DanaRInterface,
|
|||
ret += "LastBolus: " + DecimalFormatter.to2Decimal(pump.lastBolusAmount) + "U @" + android.text.format.DateFormat.format("HH:mm", pump.lastBolusTime) + "\n";
|
||||
}
|
||||
if (MainApp.getConfigBuilder().isTempBasalInProgress()) {
|
||||
ret += "Temp: " + MainApp.getConfigBuilder().getTempBasalFromHistory(new Date().getTime()).toStringFull() + "\n";
|
||||
ret += "Temp: " + MainApp.getConfigBuilder().getTempBasalFromHistory(System.currentTimeMillis()).toStringFull() + "\n";
|
||||
}
|
||||
if (MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress()) {
|
||||
ret += "Extended: " + MainApp.getConfigBuilder().getExtendedBolusFromHistory(new Date().getTime()).toString() + "\n";
|
||||
ret += "Extended: " + MainApp.getConfigBuilder().getExtendedBolusFromHistory(System.currentTimeMillis()).toString() + "\n";
|
||||
}
|
||||
if (!veryShort) {
|
||||
ret += "TDD: " + DecimalFormatter.to0Decimal(pump.dailyTotalUnits) + " / " + pump.maxDailyTotalUnits + " U\n";
|
||||
|
|
|
@ -59,7 +59,7 @@ public class MsgStatusBolusExtended_v2 extends MessageBase {
|
|||
|
||||
@NonNull
|
||||
private Date getDateFromSecAgo(int tempBasalAgoSecs) {
|
||||
return new Date((long) (Math.ceil(new Date().getTime() / 1000d) - tempBasalAgoSecs) * 1000);
|
||||
return new Date((long) (Math.ceil(System.currentTimeMillis() / 1000d) - tempBasalAgoSecs) * 1000);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ public class MsgStatusTempBasal_v2 extends MessageBase {
|
|||
|
||||
@NonNull
|
||||
private Date getDateFromTempBasalSecAgo(int tempBasalAgoSecs) {
|
||||
return new Date((long) (Math.ceil(new Date().getTime() / 1000d) - tempBasalAgoSecs) * 1000);
|
||||
return new Date((long) (Math.ceil(System.currentTimeMillis() / 1000d) - tempBasalAgoSecs) * 1000);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -171,9 +171,9 @@ public class DanaRv2ExecutionService extends Service {
|
|||
getBTSocketForSelectedPump();
|
||||
if (mRfcommSocket == null || mBTDevice == null)
|
||||
return; // Device not found
|
||||
long startTime = new Date().getTime();
|
||||
while (!isConnected() && startTime + maxConnectionTime >= new Date().getTime()) {
|
||||
long secondsElapsed = (new Date().getTime() - startTime) / 1000L;
|
||||
long startTime = System.currentTimeMillis();
|
||||
while (!isConnected() && startTime + maxConnectionTime >= System.currentTimeMillis()) {
|
||||
long secondsElapsed = (System.currentTimeMillis() - startTime) / 1000L;
|
||||
MainApp.bus().post(new EventPumpStatusChanged(EventPumpStatusChanged.CONNECTING, (int) secondsElapsed));
|
||||
if (Config.logDanaBTComm)
|
||||
log.debug("connect waiting " + secondsElapsed + "sec from: " + from);
|
||||
|
@ -200,7 +200,7 @@ public class DanaRv2ExecutionService extends Service {
|
|||
if (!MainApp.getSpecificPlugin(DanaRv2Plugin.class).isEnabled(PluginBase.PUMP))
|
||||
return;
|
||||
getBTSocketForSelectedPump();
|
||||
startTime = new Date().getTime();
|
||||
startTime = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -415,7 +415,7 @@ public class DanaRv2ExecutionService extends Service {
|
|||
}
|
||||
while (!stop.stopped && !start.failed) {
|
||||
waitMsec(100);
|
||||
if ((new Date().getTime() - progress.lastReceive) > 5 * 1000L) { // if i didn't receive status for more than 5 sec expecting broken comm
|
||||
if ((System.currentTimeMillis() - progress.lastReceive) > 5 * 1000L) { // if i didn't receive status for more than 5 sec expecting broken comm
|
||||
stop.stopped = true;
|
||||
stop.forced = true;
|
||||
log.debug("Communication stopped");
|
||||
|
|
|
@ -89,12 +89,12 @@ public class VirtualPumpFragment extends Fragment {
|
|||
|
||||
basaBasalRateView.setText(VirtualPumpPlugin.getInstance().getBaseBasalRate() + "U");
|
||||
if (MainApp.getConfigBuilder().isTempBasalInProgress()) {
|
||||
tempBasalView.setText(MainApp.getConfigBuilder().getTempBasalFromHistory(new Date().getTime()).toStringFull());
|
||||
tempBasalView.setText(MainApp.getConfigBuilder().getTempBasalFromHistory(System.currentTimeMillis()).toStringFull());
|
||||
} else {
|
||||
tempBasalView.setText("");
|
||||
}
|
||||
if (MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress()) {
|
||||
extendedBolusView.setText(MainApp.getConfigBuilder().getExtendedBolusFromHistory(new Date().getTime()).toString());
|
||||
extendedBolusView.setText(MainApp.getConfigBuilder().getExtendedBolusFromHistory(System.currentTimeMillis()).toString());
|
||||
} else {
|
||||
extendedBolusView.setText("");
|
||||
}
|
||||
|
|
|
@ -256,7 +256,7 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
|
|||
public PumpEnactResult setTempBasalAbsolute(Double absoluteRate, Integer durationInMinutes) {
|
||||
TreatmentsInterface treatmentsInterface = MainApp.getConfigBuilder();
|
||||
TemporaryBasal tempBasal = new TemporaryBasal();
|
||||
tempBasal.date = new Date().getTime();
|
||||
tempBasal.date = System.currentTimeMillis();
|
||||
tempBasal.isAbsolute = true;
|
||||
tempBasal.absoluteRate = absoluteRate;
|
||||
tempBasal.durationInMinutes = durationInMinutes;
|
||||
|
@ -286,7 +286,7 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
|
|||
return result;
|
||||
}
|
||||
TemporaryBasal tempBasal = new TemporaryBasal();
|
||||
tempBasal.date = new Date().getTime();
|
||||
tempBasal.date = System.currentTimeMillis();
|
||||
tempBasal.isAbsolute = false;
|
||||
tempBasal.percentRate = percent;
|
||||
tempBasal.durationInMinutes = durationInMinutes;
|
||||
|
@ -313,7 +313,7 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
|
|||
if (!result.success)
|
||||
return result;
|
||||
ExtendedBolus extendedBolus = new ExtendedBolus();
|
||||
extendedBolus.date = new Date().getTime();
|
||||
extendedBolus.date = System.currentTimeMillis();
|
||||
extendedBolus.insulin = insulin;
|
||||
extendedBolus.durationInMinutes = durationInMinutes;
|
||||
extendedBolus.source = Source.USER;
|
||||
|
@ -340,7 +340,7 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
|
|||
result.comment = MainApp.instance().getString(R.string.virtualpump_resultok);
|
||||
if (treatmentsInterface.isTempBasalInProgress()) {
|
||||
result.enacted = true;
|
||||
TemporaryBasal tempStop = new TemporaryBasal(new Date().getTime());
|
||||
TemporaryBasal tempStop = new TemporaryBasal(System.currentTimeMillis());
|
||||
tempStop.source = Source.USER;
|
||||
treatmentsInterface.addToHistoryTempBasal(tempStop);
|
||||
//tempBasal = null;
|
||||
|
@ -357,7 +357,7 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
|
|||
TreatmentsInterface treatmentsInterface = MainApp.getConfigBuilder();
|
||||
PumpEnactResult result = new PumpEnactResult();
|
||||
if (treatmentsInterface.isInHistoryExtendedBoluslInProgress()) {
|
||||
ExtendedBolus exStop = new ExtendedBolus(new Date().getTime());
|
||||
ExtendedBolus exStop = new ExtendedBolus(System.currentTimeMillis());
|
||||
exStop.source = Source.USER;
|
||||
treatmentsInterface.addToHistoryExtendedBolus(exStop);
|
||||
}
|
||||
|
@ -390,13 +390,13 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
|
|||
extended.put("ActiveProfile", MainApp.getConfigBuilder().getProfileName());
|
||||
} catch (Exception e) {
|
||||
}
|
||||
TemporaryBasal tb = MainApp.getConfigBuilder().getTempBasalFromHistory(new Date().getTime());
|
||||
TemporaryBasal tb = MainApp.getConfigBuilder().getTempBasalFromHistory(System.currentTimeMillis());
|
||||
if (tb != null) {
|
||||
extended.put("TempBasalAbsoluteRate", tb.tempBasalConvertedToAbsolute(new Date().getTime()));
|
||||
extended.put("TempBasalAbsoluteRate", tb.tempBasalConvertedToAbsolute(System.currentTimeMillis()));
|
||||
extended.put("TempBasalStart", DateUtil.dateAndTimeString(tb.date));
|
||||
extended.put("TempBasalRemaining", tb.getPlannedRemainingMinutes());
|
||||
}
|
||||
ExtendedBolus eb = MainApp.getConfigBuilder().getExtendedBolusFromHistory(new Date().getTime());
|
||||
ExtendedBolus eb = MainApp.getConfigBuilder().getExtendedBolusFromHistory(System.currentTimeMillis());
|
||||
if (eb != null) {
|
||||
extended.put("ExtendedBolusAbsoluteRate", eb.absoluteRate());
|
||||
extended.put("ExtendedBolusStart", DateUtil.dateAndTimeString(eb.date));
|
||||
|
|
|
@ -243,7 +243,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
|
|||
if (actualBG != null) {
|
||||
reply = MainApp.sResources.getString(R.string.sms_actualbg) + " " + actualBG.valueToUnitsToString(units) + ", ";
|
||||
} else if (lastBG != null) {
|
||||
Long agoMsec = new Date().getTime() - lastBG.date;
|
||||
Long agoMsec = System.currentTimeMillis() - lastBG.date;
|
||||
int agoMin = (int) (agoMsec / 60d / 1000d);
|
||||
reply = MainApp.sResources.getString(R.string.sms_lastbg) + " " + lastBG.valueToUnitsToString(units) + " " + String.format(MainApp.sResources.getString(R.string.sms_minago), agoMin) + ", ";
|
||||
}
|
||||
|
@ -416,7 +416,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
|
|||
}
|
||||
break;
|
||||
case "BOLUS":
|
||||
if (new Date().getTime() - lastRemoteBolusTime.getTime() < Constants.remoteBolusMinDistance) {
|
||||
if (System.currentTimeMillis() - lastRemoteBolusTime.getTime() < Constants.remoteBolusMinDistance) {
|
||||
reply = MainApp.sResources.getString(R.string.smscommunicator_remotebolusnotallowed);
|
||||
sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date()));
|
||||
} else if (MainApp.getConfigBuilder().isSuspended()) {
|
||||
|
@ -458,7 +458,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
|
|||
break;
|
||||
default: // expect passCode here
|
||||
if (bolusWaitingForConfirmation != null && !bolusWaitingForConfirmation.processed &&
|
||||
bolusWaitingForConfirmation.confirmCode.equals(splited[0]) && new Date().getTime() - bolusWaitingForConfirmation.date.getTime() < CONFIRM_TIMEOUT) {
|
||||
bolusWaitingForConfirmation.confirmCode.equals(splited[0]) && System.currentTimeMillis() - bolusWaitingForConfirmation.date.getTime() < CONFIRM_TIMEOUT) {
|
||||
bolusWaitingForConfirmation.processed = true;
|
||||
PumpInterface pumpInterface = MainApp.getConfigBuilder();
|
||||
if (pumpInterface != null) {
|
||||
|
@ -481,7 +481,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
|
|||
}
|
||||
}
|
||||
} else if (tempBasalWaitingForConfirmation != null && !tempBasalWaitingForConfirmation.processed &&
|
||||
tempBasalWaitingForConfirmation.confirmCode.equals(splited[0]) && new Date().getTime() - tempBasalWaitingForConfirmation.date.getTime() < CONFIRM_TIMEOUT) {
|
||||
tempBasalWaitingForConfirmation.confirmCode.equals(splited[0]) && System.currentTimeMillis() - tempBasalWaitingForConfirmation.date.getTime() < CONFIRM_TIMEOUT) {
|
||||
tempBasalWaitingForConfirmation.processed = true;
|
||||
PumpInterface pumpInterface = MainApp.getConfigBuilder();
|
||||
if (pumpInterface != null) {
|
||||
|
@ -500,7 +500,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
|
|||
}
|
||||
}
|
||||
} else if (cancelTempBasalWaitingForConfirmation != null && !cancelTempBasalWaitingForConfirmation.processed &&
|
||||
cancelTempBasalWaitingForConfirmation.confirmCode.equals(splited[0]) && new Date().getTime() - cancelTempBasalWaitingForConfirmation.date.getTime() < CONFIRM_TIMEOUT) {
|
||||
cancelTempBasalWaitingForConfirmation.confirmCode.equals(splited[0]) && System.currentTimeMillis() - cancelTempBasalWaitingForConfirmation.date.getTime() < CONFIRM_TIMEOUT) {
|
||||
cancelTempBasalWaitingForConfirmation.processed = true;
|
||||
PumpInterface pumpInterface = MainApp.getConfigBuilder();
|
||||
if (pumpInterface != null) {
|
||||
|
@ -519,7 +519,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
|
|||
}
|
||||
}
|
||||
} else if (calibrationWaitingForConfirmation != null && !calibrationWaitingForConfirmation.processed &&
|
||||
calibrationWaitingForConfirmation.confirmCode.equals(splited[0]) && new Date().getTime() - calibrationWaitingForConfirmation.date.getTime() < CONFIRM_TIMEOUT) {
|
||||
calibrationWaitingForConfirmation.confirmCode.equals(splited[0]) && System.currentTimeMillis() - calibrationWaitingForConfirmation.date.getTime() < CONFIRM_TIMEOUT) {
|
||||
calibrationWaitingForConfirmation.processed = true;
|
||||
boolean result = XdripCalibrations.sendIntent(calibrationWaitingForConfirmation.calibrationRequested);
|
||||
if (result) {
|
||||
|
@ -530,10 +530,10 @@ public class SmsCommunicatorPlugin implements PluginBase {
|
|||
sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date()));
|
||||
}
|
||||
} else if (suspendWaitingForConfirmation != null && !suspendWaitingForConfirmation.processed &&
|
||||
suspendWaitingForConfirmation.confirmCode.equals(splited[0]) && new Date().getTime() - suspendWaitingForConfirmation.date.getTime() < CONFIRM_TIMEOUT) {
|
||||
suspendWaitingForConfirmation.confirmCode.equals(splited[0]) && System.currentTimeMillis() - suspendWaitingForConfirmation.date.getTime() < CONFIRM_TIMEOUT) {
|
||||
suspendWaitingForConfirmation.processed = true;
|
||||
final LoopPlugin activeloop = ConfigBuilderPlugin.getActiveLoop();
|
||||
activeloop.suspendTo(new Date().getTime() + suspendWaitingForConfirmation.duration * 60L * 1000);
|
||||
activeloop.suspendTo(System.currentTimeMillis() + suspendWaitingForConfirmation.duration * 60L * 1000);
|
||||
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal();
|
||||
NSUpload.uploadOpenAPSOffline(suspendWaitingForConfirmation.duration * 60);
|
||||
MainApp.bus().post(new EventRefreshGui(false));
|
||||
|
|
|
@ -129,7 +129,7 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface {
|
|||
public static void initializeTreatmentData() {
|
||||
// Treatments
|
||||
double dia = MainApp.getConfigBuilder() == null ? Constants.defaultDIA : MainApp.getConfigBuilder().getProfile().getDia();
|
||||
long fromMills = (long) (new Date().getTime() - 60 * 60 * 1000L * (24 + dia));
|
||||
long fromMills = (long) (System.currentTimeMillis() - 60 * 60 * 1000L * (24 + dia));
|
||||
|
||||
treatments = MainApp.getDbHelper().getTreatmentDataFromTime(fromMills, false);
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface {
|
|||
public static void initializeTempBasalData() {
|
||||
// Treatments
|
||||
double dia = MainApp.getConfigBuilder() == null ? Constants.defaultDIA : MainApp.getConfigBuilder().getProfile().getDia();
|
||||
long fromMills = (long) (new Date().getTime() - 60 * 60 * 1000L * (24 + dia));
|
||||
long fromMills = (long) (System.currentTimeMillis() - 60 * 60 * 1000L * (24 + dia));
|
||||
|
||||
tempBasals.reset().add(MainApp.getDbHelper().getTemporaryBasalsDataFromTime(fromMills, false));
|
||||
|
||||
|
@ -146,14 +146,14 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface {
|
|||
public static void initializeExtendedBolusData() {
|
||||
// Treatments
|
||||
double dia = MainApp.getConfigBuilder() == null ? Constants.defaultDIA : MainApp.getConfigBuilder().getProfile().getDia();
|
||||
long fromMills = (long) (new Date().getTime() - 60 * 60 * 1000L * (24 + dia));
|
||||
long fromMills = (long) (System.currentTimeMillis() - 60 * 60 * 1000L * (24 + dia));
|
||||
|
||||
extendedBoluses.reset().add(MainApp.getDbHelper().getExtendedBolusDataFromTime(fromMills, false));
|
||||
|
||||
}
|
||||
|
||||
public void initializeTempTargetData() {
|
||||
long fromMills = new Date().getTime() - 60 * 60 * 1000L * 24;
|
||||
long fromMills = System.currentTimeMillis() - 60 * 60 * 1000L * 24;
|
||||
tempTargets.reset().add(MainApp.getDbHelper().getTemptargetsDataFromTime(fromMills, false));
|
||||
}
|
||||
|
||||
|
@ -198,7 +198,7 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface {
|
|||
|
||||
@Override
|
||||
public void updateTotalIOBTreatments() {
|
||||
IobTotal total = getCalculationToTimeTreatments(new Date().getTime());
|
||||
IobTotal total = getCalculationToTimeTreatments(System.currentTimeMillis());
|
||||
|
||||
lastTreatmentCalculation = total;
|
||||
}
|
||||
|
@ -210,7 +210,7 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface {
|
|||
Profile profile = MainApp.getConfigBuilder().getProfile();
|
||||
if (profile == null) return result;
|
||||
|
||||
long now = new Date().getTime();
|
||||
long now = System.currentTimeMillis();
|
||||
long dia_ago = now - (new Double(1.5d * profile.getDia() * 60 * 60 * 1000l)).longValue();
|
||||
|
||||
for (Treatment treatment : treatments) {
|
||||
|
@ -250,7 +250,7 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface {
|
|||
|
||||
@Override
|
||||
public boolean isInHistoryRealTempBasalInProgress() {
|
||||
return getRealTempBasalFromHistory(new Date().getTime()) != null;
|
||||
return getRealTempBasalFromHistory(System.currentTimeMillis()) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -260,12 +260,12 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface {
|
|||
|
||||
@Override
|
||||
public boolean isTempBasalInProgress() {
|
||||
return getTempBasalFromHistory(new Date().getTime()) != null;
|
||||
return getTempBasalFromHistory(System.currentTimeMillis()) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInHistoryExtendedBoluslInProgress() {
|
||||
return getExtendedBolusFromHistory(new Date().getTime()) != null; //TODO: crosscheck here
|
||||
return getExtendedBolusFromHistory(System.currentTimeMillis()) != null; //TODO: crosscheck here
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
|
@ -318,7 +318,7 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface {
|
|||
|
||||
@Override
|
||||
public void updateTotalIOBTempBasals() {
|
||||
IobTotal total = getCalculationToTimeTempBasals(new Date().getTime());
|
||||
IobTotal total = getCalculationToTimeTempBasals(System.currentTimeMillis());
|
||||
|
||||
lastTempBasalsCalculation = total;
|
||||
}
|
||||
|
@ -355,7 +355,7 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface {
|
|||
public double getTempBasalAbsoluteRateHistory() {
|
||||
PumpInterface pump = MainApp.getConfigBuilder();
|
||||
|
||||
TemporaryBasal tb = getTempBasalFromHistory(new Date().getTime());
|
||||
TemporaryBasal tb = getTempBasalFromHistory(System.currentTimeMillis());
|
||||
if (tb != null) {
|
||||
if (tb.isAbsolute) {
|
||||
return tb.absoluteRate;
|
||||
|
@ -371,7 +371,7 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface {
|
|||
@Override
|
||||
public double getTempBasalRemainingMinutesFromHistory() {
|
||||
if (isTempBasalInProgress())
|
||||
return getTempBasalFromHistory(new Date().getTime()).getPlannedRemainingMinutes();
|
||||
return getTempBasalFromHistory(System.currentTimeMillis()).getPlannedRemainingMinutes();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -414,7 +414,7 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface {
|
|||
|
||||
@Override
|
||||
public long oldestDataAvailable() {
|
||||
long oldestTime = new Date().getTime();
|
||||
long oldestTime = System.currentTimeMillis();
|
||||
if (tempBasals.size() > 0)
|
||||
oldestTime = Math.min(oldestTime, tempBasals.get(0).date);
|
||||
if (extendedBoluses.size() > 0)
|
||||
|
|
|
@ -78,7 +78,7 @@ public class TreatmentsBolusFragment extends Fragment implements View.OnClickLis
|
|||
holder.date.setText(DateUtil.dateAndTimeString(t.date));
|
||||
holder.insulin.setText(DecimalFormatter.to2Decimal(t.insulin) + " U");
|
||||
holder.carbs.setText(DecimalFormatter.to0Decimal(t.carbs) + " g");
|
||||
Iob iob = t.iobCalc(new Date().getTime(), profile.getDia());
|
||||
Iob iob = t.iobCalc(System.currentTimeMillis(), profile.getDia());
|
||||
holder.iob.setText(DecimalFormatter.to2Decimal(iob.iobContrib) + " U");
|
||||
holder.activity.setText(DecimalFormatter.to3Decimal(iob.activityContrib) + " U");
|
||||
holder.mealOrCorrection.setText(t.mealBolus ? MainApp.sResources.getString(R.string.mealbolus) : MainApp.sResources.getString(R.string.correctionbous));
|
||||
|
|
|
@ -82,7 +82,7 @@ public class TreatmentsExtendedBolusesFragment extends Fragment {
|
|||
holder.duration.setText(DecimalFormatter.to0Decimal(extendedBolus.durationInMinutes) + " min");
|
||||
holder.insulin.setText(DecimalFormatter.to2Decimal(extendedBolus.insulin) + " U");
|
||||
holder.realDuration.setText(DecimalFormatter.to0Decimal(extendedBolus.getRealDuration()) + " min");
|
||||
IobTotal iob = extendedBolus.iobCalc(new Date().getTime());
|
||||
IobTotal iob = extendedBolus.iobCalc(System.currentTimeMillis());
|
||||
holder.iob.setText(DecimalFormatter.to2Decimal(iob.iob) + " U");
|
||||
holder.insulinSoFar.setText(DecimalFormatter.to2Decimal(extendedBolus.insulinSoFar()) + " U");
|
||||
holder.ratio.setText(DecimalFormatter.to2Decimal(extendedBolus.absoluteRate()) + " U/h");
|
||||
|
@ -90,7 +90,7 @@ public class TreatmentsExtendedBolusesFragment extends Fragment {
|
|||
holder.date.setTextColor(ContextCompat.getColor(MainApp.instance(), R.color.colorActive));
|
||||
else
|
||||
holder.date.setTextColor(holder.insulin.getCurrentTextColor());
|
||||
if (extendedBolus.iobCalc(new Date().getTime()).iob != 0)
|
||||
if (extendedBolus.iobCalc(System.currentTimeMillis()).iob != 0)
|
||||
holder.iob.setTextColor(ContextCompat.getColor(MainApp.instance(), R.color.colorActive));
|
||||
else
|
||||
holder.iob.setTextColor(holder.insulin.getCurrentTextColor());
|
||||
|
|
|
@ -93,7 +93,7 @@ public class TreatmentsTemporaryBasalsFragment extends Fragment {
|
|||
holder.percent.setText(DecimalFormatter.to0Decimal(tempBasal.percentRate) + "%");
|
||||
}
|
||||
holder.realDuration.setText(DecimalFormatter.to0Decimal(tempBasal.getRealDuration()) + " min");
|
||||
IobTotal iob = tempBasal.iobCalc(new Date().getTime());
|
||||
IobTotal iob = tempBasal.iobCalc(System.currentTimeMillis());
|
||||
holder.iob.setText(DecimalFormatter.to2Decimal(iob.basaliob) + " U");
|
||||
holder.netInsulin.setText(DecimalFormatter.to2Decimal(iob.netInsulin) + " U");
|
||||
holder.netRatio.setText(DecimalFormatter.to2Decimal(iob.netRatio) + " U/h");
|
||||
|
@ -103,7 +103,7 @@ public class TreatmentsTemporaryBasalsFragment extends Fragment {
|
|||
holder.date.setTextColor(ContextCompat.getColor(MainApp.instance(), R.color.colorActive));
|
||||
else
|
||||
holder.date.setTextColor(holder.netRatio.getCurrentTextColor());
|
||||
if (tempBasal.iobCalc(new Date().getTime()).basaliob != 0)
|
||||
if (tempBasal.iobCalc(System.currentTimeMillis()).basaliob != 0)
|
||||
holder.iob.setTextColor(ContextCompat.getColor(MainApp.instance(), R.color.colorActive));
|
||||
else
|
||||
holder.iob.setTextColor(holder.netRatio.getCurrentTextColor());
|
||||
|
|
|
@ -276,7 +276,7 @@ public class ActionStringHandler {
|
|||
}
|
||||
|
||||
//Check for Temp-Target:
|
||||
TempTarget tempTarget = MainApp.getConfigBuilder().getTempTargetFromHistory(new Date().getTime());
|
||||
TempTarget tempTarget = MainApp.getConfigBuilder().getTempTargetFromHistory(System.currentTimeMillis());
|
||||
if (tempTarget != null) {
|
||||
ret += "Temp Target: " + Profile.toUnitsString(tempTarget.low, Profile.fromMgdlToUnits(tempTarget.low, profile.getUnits()), profile.getUnits()) + " - " + Profile.toUnitsString(tempTarget.high, Profile.fromMgdlToUnits(tempTarget.high, profile.getUnits()), profile.getUnits());
|
||||
ret += "\nuntil: " + DateUtil.timeString(tempTarget.originalEnd());
|
||||
|
@ -347,7 +347,7 @@ public class ActionStringHandler {
|
|||
|
||||
private static void generateTempTarget(int duration, double low, double high) {
|
||||
TempTarget tempTarget = new TempTarget();
|
||||
tempTarget.date = new Date().getTime();
|
||||
tempTarget.date = System.currentTimeMillis();
|
||||
tempTarget.durationInMinutes = duration;
|
||||
tempTarget.reason = "WearPlugin";
|
||||
tempTarget.source = Source.USER;
|
||||
|
|
|
@ -540,7 +540,7 @@ public class WatchUpdaterService extends WearableListenerService implements
|
|||
TreatmentsInterface treatmentsInterface = MainApp.getConfigBuilder();
|
||||
|
||||
if (treatmentsInterface.isTempBasalInProgress()) {
|
||||
TemporaryBasal activeTemp = treatmentsInterface.getTempBasalFromHistory(new Date().getTime());
|
||||
TemporaryBasal activeTemp = treatmentsInterface.getTempBasalFromHistory(System.currentTimeMillis());
|
||||
if (shortString) {
|
||||
status += activeTemp.toStringShort();
|
||||
} else {
|
||||
|
|
|
@ -166,7 +166,7 @@ public class StatuslinePlugin implements PluginBase {
|
|||
TreatmentsInterface treatmentsInterface = MainApp.getConfigBuilder();
|
||||
|
||||
if (treatmentsInterface.isTempBasalInProgress()) {
|
||||
TemporaryBasal activeTemp = treatmentsInterface.getTempBasalFromHistory(new Date().getTime());
|
||||
TemporaryBasal activeTemp = treatmentsInterface.getTempBasalFromHistory(System.currentTimeMillis());
|
||||
if (shortString) {
|
||||
status += activeTemp.toStringShort();
|
||||
} else {
|
||||
|
|
|
@ -40,7 +40,7 @@ public class KeepAliveReceiver extends BroadcastReceiver {
|
|||
boolean isStatusOutdated = false;
|
||||
|
||||
Date lastConnection = pump.lastDataTime();
|
||||
if (lastConnection.getTime() + 30 * 60 * 1000L < new Date().getTime())
|
||||
if (lastConnection.getTime() + 30 * 60 * 1000L < System.currentTimeMillis())
|
||||
isStatusOutdated = true;
|
||||
if (Math.abs(profile.getBasal() - pump.getBaseBasalRate()) > pump.getPumpDescription().basalStep)
|
||||
isBasalOutdated = true;
|
||||
|
|
|
@ -97,7 +97,7 @@ public class BolusWizard {
|
|||
// Insulin from superbolus for 2h. Get basal rate now and after 1h
|
||||
if (superBolus) {
|
||||
insulinFromSuperBolus = specificProfile.getBasal();
|
||||
long timeAfter1h = new Date().getTime();
|
||||
long timeAfter1h = System.currentTimeMillis();
|
||||
timeAfter1h += 60L * 60 * 1000;
|
||||
insulinFromSuperBolus += specificProfile.getBasal(timeAfter1h);
|
||||
}
|
||||
|
|
|
@ -190,7 +190,7 @@ public class NSUpload {
|
|||
DeviceStatus deviceStatus = new DeviceStatus();
|
||||
try {
|
||||
LoopPlugin.LastRun lastRun = LoopPlugin.lastRun;
|
||||
if (lastRun != null && lastRun.lastAPSRun.getTime() > new Date().getTime() - 300 * 1000L) {
|
||||
if (lastRun != null && lastRun.lastAPSRun.getTime() > System.currentTimeMillis() - 300 * 1000L) {
|
||||
// do not send if result is older than 1 min
|
||||
APSResult apsResult = lastRun.request;
|
||||
apsResult.json().put("timestamp", DateUtil.toISOString(lastRun.lastAPSRun));
|
||||
|
|
|
@ -12,7 +12,7 @@ public class Profiler {
|
|||
public Profiler(){}
|
||||
|
||||
static public void log(Logger log, String function, Date start) {
|
||||
long msec = new Date().getTime() - start.getTime();
|
||||
long msec = System.currentTimeMillis() - start.getTime();
|
||||
log.debug(">>> " + function + " <<< executed in " + msec + " miliseconds");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ public class XdripCalibrations {
|
|||
Bundle bundle = new Bundle();
|
||||
bundle.putDouble("glucose_number", bg);
|
||||
bundle.putString("units", MainApp.getConfigBuilder().getProfileUnits().equals(Constants.MGDL) ? "mgdl" : "mmol");
|
||||
bundle.putLong("timestamp", new Date().getTime());
|
||||
bundle.putLong("timestamp", System.currentTimeMillis());
|
||||
Intent intent = new Intent(Intents.ACTION_REMOTE_CALIBRATION);
|
||||
intent.putExtras(bundle);
|
||||
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
|
||||
|
|
|
@ -626,7 +626,7 @@ public class BIGChart extends WatchFace implements SharedPreferences.OnSharedPre
|
|||
}
|
||||
|
||||
for (int i = 0; i < bgDataList.size(); i++) {
|
||||
if (bgDataList.get(i).timestamp < (new Date().getTime() - (1000 * 60 * 60 * 5))) {
|
||||
if (bgDataList.get(i).timestamp < (System.currentTimeMillis() - (1000 * 60 * 60 * 5))) {
|
||||
bgDataList.remove(i); //Get rid of anything more than 5 hours old
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -393,7 +393,7 @@ protected abstract void setColorDark();
|
|||
}
|
||||
|
||||
for (int i = 0; i < bgDataList.size(); i++) {
|
||||
if (bgDataList.get(i).timestamp < (new Date().getTime() - (1000 * 60 * 60 * 5))) {
|
||||
if (bgDataList.get(i).timestamp < (System.currentTimeMillis() - (1000 * 60 * 60 * 5))) {
|
||||
bgDataList.remove(i); //Get rid of anything more than 5 hours old
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -56,8 +56,8 @@ public class BgGraphBuilder {
|
|||
|
||||
//used for low resolution screen.
|
||||
public BgGraphBuilder(Context context, List<BgWatchData> aBgList, List<TempWatchData> tempWatchDataList, ArrayList<BasalWatchData> basalWatchDataList, int aPointSize, int aMidColor, int gridColour, int basalBackgroundColor, int basalCenterColor, int timespan) {
|
||||
end_time = new Date().getTime() + (1000 * 60 * 6 * timespan); //Now plus 30 minutes padding (for 5 hours. Less if less.)
|
||||
start_time = new Date().getTime() - (1000 * 60 * 60 * timespan); //timespan hours ago
|
||||
end_time = System.currentTimeMillis() + (1000 * 60 * 6 * timespan); //Now plus 30 minutes padding (for 5 hours. Less if less.)
|
||||
start_time = System.currentTimeMillis() - (1000 * 60 * 60 * timespan); //timespan hours ago
|
||||
this.bgDataList = aBgList;
|
||||
this.context = context;
|
||||
this.highMark = aBgList.get(aBgList.size() - 1).high;
|
||||
|
@ -76,8 +76,8 @@ public class BgGraphBuilder {
|
|||
}
|
||||
|
||||
public BgGraphBuilder(Context context, List<BgWatchData> aBgList, List<TempWatchData> tempWatchDataList, ArrayList<BasalWatchData> basalWatchDataList, int aPointSize, int aHighColor, int aLowColor, int aMidColor, int gridColour, int basalBackgroundColor, int basalCenterColor, int timespan) {
|
||||
end_time = new Date().getTime() + (1000 * 60 * 6 * timespan); //Now plus 30 minutes padding (for 5 hours. Less if less.)
|
||||
start_time = new Date().getTime() - (1000 * 60 * 60 * timespan); //timespan hours ago
|
||||
end_time = System.currentTimeMillis() + (1000 * 60 * 6 * timespan); //Now plus 30 minutes padding (for 5 hours. Less if less.)
|
||||
start_time = System.currentTimeMillis() - (1000 * 60 * 60 * timespan); //timespan hours ago
|
||||
this.bgDataList = aBgList;
|
||||
this.context = context;
|
||||
this.highMark = aBgList.get(aBgList.size() - 1).high;
|
||||
|
@ -317,7 +317,7 @@ public class BgGraphBuilder {
|
|||
SimpleDateFormat timeFormat = new SimpleDateFormat(is24? "HH" : "h a");
|
||||
timeFormat.setTimeZone(TimeZone.getDefault());
|
||||
double start_hour = today.getTime().getTime();
|
||||
double timeNow = new Date().getTime();
|
||||
double timeNow = System.currentTimeMillis();
|
||||
for (int l = 0; l <= 24; l++) {
|
||||
if ((start_hour + (60000 * 60 * (l))) < timeNow) {
|
||||
if ((start_hour + (60000 * 60 * (l + 1))) >= timeNow) {
|
||||
|
|
|
@ -596,7 +596,7 @@ public class CircleWatchface extends WatchFace implements SharedPreferences.OnSh
|
|||
|
||||
Log.d("addToWatchSet", "start removing bgDataList.size(): " + bgDataList.size());
|
||||
HashSet removeSet = new HashSet();
|
||||
double threshold = (new Date().getTime() - (1000 * 60 * 5 * holdInMemory()));
|
||||
double threshold = (System.currentTimeMillis() - (1000 * 60 * 5 * holdInMemory()));
|
||||
for (BgWatchData data : bgDataList) {
|
||||
if (data.timestamp < threshold) {
|
||||
removeSet.add(data);
|
||||
|
@ -674,7 +674,7 @@ public class CircleWatchface extends WatchFace implements SharedPreferences.OnSh
|
|||
}
|
||||
|
||||
float offsetMultiplier = (((displaySize.x / 2f) - PADDING) / 12f);
|
||||
float offset = (float) Math.max(1, Math.ceil((new Date().getTime() - entry.timestamp) / (1000 * 60 * 5)));
|
||||
float offset = (float) Math.max(1, Math.ceil((System.currentTimeMillis() - entry.timestamp) / (1000 * 60 * 5)));
|
||||
size = bgToAngle((float) entry.sgv);
|
||||
addArch(canvas, offset * offsetMultiplier + 10, color, (float) size);
|
||||
addArch(canvas, (float) size, offset * offsetMultiplier + 10, getBackgroundColor(), (float) (360 - size));
|
||||
|
@ -700,7 +700,7 @@ public class CircleWatchface extends WatchFace implements SharedPreferences.OnSh
|
|||
barColor = darken(getLowColor(), .5);
|
||||
}
|
||||
float offsetMultiplier = (((displaySize.x / 2f) - PADDING) / 12f);
|
||||
float offset = (float) Math.max(1, Math.ceil((new Date().getTime() - entry.timestamp) / (1000 * 60 * 5)));
|
||||
float offset = (float) Math.max(1, Math.ceil((System.currentTimeMillis() - entry.timestamp) / (1000 * 60 * 5)));
|
||||
size = bgToAngle((float) entry.sgv);
|
||||
addArch(canvas, offset * offsetMultiplier + 11, barColor, (float) size - 2); // Dark Color Bar
|
||||
addArch(canvas, (float) size - 2, offset * offsetMultiplier + 11, indicatorColor, 2f); // Indicator at end of bar
|
||||
|
|
Loading…
Reference in a new issue