Java Code Examples for com.eveningoutpost.dexdrip.UtilityModels.Constants#DAY_IN_MS

The following examples show how to use com.eveningoutpost.dexdrip.UtilityModels.Constants#DAY_IN_MS . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Reminders.java    From xDrip-plus with GNU General Public License v3.0 6 votes vote down vote up
private long getPeriod(RadioButton rbday, RadioButton rbhour, RadioButton rbweek) {
    long period;
    try {
        period = Integer.parseInt(reminderDaysEdt.getText().toString());
    } catch (NumberFormatException e) {
        period = 1; // TODO avoid this happening from the UI
        try {
            reminderDaysEdt.setText("" + period);
        } catch (Exception ee) {
            //
        }
    }
    if (rbday.isChecked()) {
        period = period * Constants.DAY_IN_MS;
    } else if (rbhour.isChecked()) {
        period = period * Constants.HOUR_IN_MS;
    } else if (rbweek.isChecked()) {
        period = period * Constants.WEEK_IN_MS;
    }
    return period;
}
 
Example 2
Source File: SensorDays.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
public static SensorDays get(final DexCollectionType type, final String tx_id) {

        // get cached result
        val result = cache.get(type.toString() + tx_id);
        if (result != null && result.cacheValid()) return result;

        val ths = new SensorDays();

        if (hasLibre(type)) {
            ths.period = Constants.DAY_IN_MS * 14; // TODO 10 day sensors?
            ths.strategy = USE_LIBRE_STRATEGY;

        } else if (hasDexcomRaw(type)) {
            ths.strategy = USE_DEXCOM_STRATEGY;
            val vr2 = (VersionRequest2RxMessage)
                    getFirmwareXDetails(tx_id, 2);
            if (vr2 != null) {
                ths.period = Constants.DAY_IN_MS * vr2.typicalSensorDays;
            } else {
                if (usingG6()) {
                    ths.period = Constants.DAY_IN_MS * 10; // G6 default
                } else {
                    ths.period = Constants.DAY_IN_MS * 7; // G5
                }
            }

        } else {
            // unknown type
        }
        ths.created = tsl();
        cache.put(type.toString() + tx_id, ths);
        return ths;
    }
 
Example 3
Source File: UserError.java    From xDrip with GNU General Public License v3.0 5 votes vote down vote up
public String bestTime() {
    final long since = JoH.msSince(timestamp);
    if (since < Constants.DAY_IN_MS) {
        return JoH.hourMinuteString(timestamp);
    } else {
        return JoH.dateTimeText(timestamp);
    }
}
 
Example 4
Source File: JoH.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
public static String niceTimeScalarNatural(long t) {
    if (t > 3000000) t = t + 10000; // round up by 10 seconds if nearly an hour
    if ((t > Constants.DAY_IN_MS) && (t < Constants.WEEK_IN_MS * 2)) {
        final SimpleDateFormat df = new SimpleDateFormat("EEEE", Locale.getDefault());
        final String day = df.format(new Date(JoH.tsl() + t));
        return ((t > Constants.WEEK_IN_MS) ? "next " : "") + day;
    } else {
        return niceTimeScalar(t);
    }
}
 
Example 5
Source File: Reminders.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
private void askTime(final int position) {
    final Calendar calendar = Calendar.getInstance();
    final Reminder reminder = reminders.get(position);
    calendar.setTimeInMillis(reminder.next_due);

    final TimePickerFragment timePickerFragment = new TimePickerFragment();
    timePickerFragment.setTime(calendar.get(Calendar.HOUR_OF_DAY), calendar.get(Calendar.MINUTE));
    timePickerFragment.setTitle(xdrip.getAppContext().getString(R.string.title_what_time_day));
    timePickerFragment.setTimeCallback(new ProfileAdapter.TimePickerCallbacks() {
        @Override
        public void onTimeUpdated(int newmins) {
            int min = newmins % 60;
            int hour = (newmins - min) / 60;
            calendar.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH), hour, min);
            reminder.next_due = calendar.getTimeInMillis();
            reminder.snoozed_till = 0; // reset this field
            reminder.save();
            freshen(reminder);
        }
    });
    timePickerFragment.show(this.getFragmentManager(), "TimePicker");

    // appears on top
    if (JoH.msTill(reminder.next_due) > Constants.DAY_IN_MS) {
        final DatePickerFragment datePickerFragment = new DatePickerFragment();
        datePickerFragment.setAllowFuture(true);
        datePickerFragment.setEarliestDate(JoH.tsl());
        datePickerFragment.setInitiallySelectedDate(reminder.next_due);
        datePickerFragment.setTitle(xdrip.getAppContext().getString(R.string.title_which_day));
        datePickerFragment.setDateCallback(new ProfileAdapter.DatePickerCallbacks() {
            @Override
            public void onDateSet(int year, int month, int day) {
                calendar.set(year, month, day);

            }
        });
        datePickerFragment.show(this.getFragmentManager(), "DatePicker");
    }
}
 
Example 6
Source File: BasalChart.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
static private Axis chartXAxis(int size) {

        final Axis xAxis = new Axis();
        xAxis.setAutoGenerated(false);
        xAxis.setHasTiltedLabels(true);
        xAxis.setTiltAngle(-90f);
        xAxis.setMaxLabelChars(7);

        SimpleDateFormat sdf = new SimpleDateFormat(DateFormat.is24HourFormat(xdrip.getAppContext()) ? "HH:mm" : "a h:mm");

        DateFormatSymbols symbols = new DateFormatSymbols(Locale.getDefault());
        // OVERRIDE SOME symbols WHILE RETAINING OTHERS
        symbols.setAmPmStrings(new String[] { "a", "p" });
        sdf.setDateFormatSymbols(symbols);

        final java.text.DateFormat timeFormat = sdf;
        timeFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
        final GregorianCalendar calendar = new GregorianCalendar();
        calendar.setTimeInMillis(JoH.tsl());
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        calendar.set(Calendar.MILLISECOND, 0);

        xAxis.setAutoGenerated(false);

        // TODO make this a better am/pm/24 hour thingy by dividing a day down? DST??? how does that work?? - done on load of value?
        List<AxisValue> axisValues = new ArrayList<>();
        final int step = size / segments;
        final long dayStartMs = calendar.getTimeInMillis();
        final long increment = Constants.DAY_IN_MS / segments;
        for (int i = 0; i < size; i = i + step) {
            calendar.setTimeInMillis(dayStartMs + i*increment);
            axisValues.add(new AxisValue(i / step,  timeFormat.format(calendar.getTimeInMillis()).toCharArray()));
        }
        xAxis.setValues(axisValues);
        return xAxis;
    }
 
Example 7
Source File: Reminders.java    From xDrip with GNU General Public License v3.0 5 votes vote down vote up
public void snoozeAdjust(View v) {
    final String button_text = ((Button) v).getTag().toString(); //changed String to Tag, to make the texts translateable
    Log.d(TAG, "Snooze adjust button: " + button_text);
    long multiplier = Constants.MINUTE_IN_MS;
    final String[] button_textA = button_text.split(" ");
    switch (button_textA[1].toLowerCase()) {
        case "hour":
        case "hours":
            multiplier = Constants.HOUR_IN_MS;
            break;

        case "day":
        case "days":
            multiplier = Constants.DAY_IN_MS;
            break;

        case "week":
        case "weeks":
            multiplier = Constants.WEEK_IN_MS;
            break;
    }
    final long snooze_adjust = Integer.parseInt(button_textA[0]) * multiplier;
    Log.d(TAG, "Snoozed adjust button result: " + snooze_adjust);
    dismissItem(last_swiped);
    snoozeReminder(last_swiped, snooze_adjust);
    reinject(last_swiped);
}
 
Example 8
Source File: JoH.java    From xDrip with GNU General Public License v3.0 5 votes vote down vote up
public static String niceTimeScalarNatural(long t) {
    if (t > 3000000) t = t + 10000; // round up by 10 seconds if nearly an hour
    if ((t > Constants.DAY_IN_MS) && (t < Constants.WEEK_IN_MS * 2)) {
        final SimpleDateFormat df = new SimpleDateFormat("EEEE", Locale.getDefault());
        final String day = df.format(new Date(JoH.tsl() + t));
        return ((t > Constants.WEEK_IN_MS) ? "next " : "") + day;
    } else {
        return niceTimeScalar(t);
    }
}
 
Example 9
Source File: Reminders.java    From xDrip with GNU General Public License v3.0 5 votes vote down vote up
private void askTime(final int position) {
    final Calendar calendar = Calendar.getInstance();
    final Reminder reminder = reminders.get(position);
    calendar.setTimeInMillis(reminder.next_due);

    final TimePickerFragment timePickerFragment = new TimePickerFragment();
    timePickerFragment.setTime(calendar.get(Calendar.HOUR_OF_DAY), calendar.get(Calendar.MINUTE));
    timePickerFragment.setTitle(xdrip.getAppContext().getString(R.string.title_what_time_day));
    timePickerFragment.setTimeCallback(new ProfileAdapter.TimePickerCallbacks() {
        @Override
        public void onTimeUpdated(int newmins) {
            int min = newmins % 60;
            int hour = (newmins - min) / 60;
            calendar.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH), hour, min);
            reminder.next_due = calendar.getTimeInMillis();
            reminder.snoozed_till = 0; // reset this field
            reminder.save();
            freshen(reminder);
        }
    });
    timePickerFragment.show(this.getFragmentManager(), "TimePicker");

    // appears on top
    if (JoH.msTill(reminder.next_due) > Constants.DAY_IN_MS) {
        final DatePickerFragment datePickerFragment = new DatePickerFragment();
        datePickerFragment.setAllowFuture(true);
        datePickerFragment.setEarliestDate(JoH.tsl());
        datePickerFragment.setInitiallySelectedDate(reminder.next_due);
        datePickerFragment.setTitle(xdrip.getAppContext().getString(R.string.title_which_day));
        datePickerFragment.setDateCallback(new ProfileAdapter.DatePickerCallbacks() {
            @Override
            public void onDateSet(int year, int month, int day) {
                calendar.set(year, month, day);

            }
        });
        datePickerFragment.show(this.getFragmentManager(), "DatePicker");
    }
}
 
Example 10
Source File: Reminders.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
public void snoozeAdjust(View v) {
    final String button_text = ((Button) v).getTag().toString(); //changed String to Tag, to make the texts translateable
    Log.d(TAG, "Snooze adjust button: " + button_text);
    long multiplier = Constants.MINUTE_IN_MS;
    final String[] button_textA = button_text.split(" ");
    switch (button_textA[1].toLowerCase()) {
        case "hour":
        case "hours":
            multiplier = Constants.HOUR_IN_MS;
            break;

        case "day":
        case "days":
            multiplier = Constants.DAY_IN_MS;
            break;

        case "week":
        case "weeks":
            multiplier = Constants.WEEK_IN_MS;
            break;
    }
    final long snooze_adjust = Integer.parseInt(button_textA[0]) * multiplier;
    Log.d(TAG, "Snoozed adjust button result: " + snooze_adjust);
    dismissItem(last_swiped);
    snoozeReminder(last_swiped, snooze_adjust);
    reinject(last_swiped);
}
 
Example 11
Source File: BasalChart.java    From xDrip with GNU General Public License v3.0 5 votes vote down vote up
static private Axis chartXAxis(int size) {

        final Axis xAxis = new Axis();
        xAxis.setAutoGenerated(false);
        xAxis.setHasTiltedLabels(true);
        xAxis.setTiltAngle(-90f);
        xAxis.setMaxLabelChars(7);

        SimpleDateFormat sdf = new SimpleDateFormat(DateFormat.is24HourFormat(xdrip.getAppContext()) ? "HH:mm" : "a h:mm");

        DateFormatSymbols symbols = new DateFormatSymbols(Locale.getDefault());
        // OVERRIDE SOME symbols WHILE RETAINING OTHERS
        symbols.setAmPmStrings(new String[] { "a", "p" });
        sdf.setDateFormatSymbols(symbols);

        final java.text.DateFormat timeFormat = sdf;
        timeFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
        final GregorianCalendar calendar = new GregorianCalendar();
        calendar.setTimeInMillis(JoH.tsl());
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        calendar.set(Calendar.MILLISECOND, 0);

        xAxis.setAutoGenerated(false);

        // TODO make this a better am/pm/24 hour thingy by dividing a day down? DST??? how does that work?? - done on load of value?
        List<AxisValue> axisValues = new ArrayList<>();
        final int step = size / segments;
        final long dayStartMs = calendar.getTimeInMillis();
        final long increment = Constants.DAY_IN_MS / segments;
        for (int i = 0; i < size; i = i + step) {
            calendar.setTimeInMillis(dayStartMs + i*increment);
            axisValues.add(new AxisValue(i / step,  timeFormat.format(calendar.getTimeInMillis()).toCharArray()));
        }
        xAxis.setValues(axisValues);
        return xAxis;
    }
 
Example 12
Source File: DesertComms.java    From xDrip-plus with GNU General Public License v3.0 4 votes vote down vote up
boolean expired() {
    return oneHit() || retried > MAX_RETRIES || msSince(entryTime) > Constants.DAY_IN_MS;
}
 
Example 13
Source File: Reminder.java    From xDrip-plus with GNU General Public License v3.0 4 votes vote down vote up
public long periodInUnits() {
    if (isDaysPeriod()) return period / Constants.DAY_IN_MS;
    if (isHoursPeriod()) return period / Constants.HOUR_IN_MS;
    if (isWeeksPeriod()) return period / Constants.WEEK_IN_MS;
    return -1; // ERROR
}
 
Example 14
Source File: Reminders.java    From xDrip-plus with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onBindViewHolder(final ActivityWithRecycler.MyViewHolder base_holder, int position) {
    final MyViewHolder holder = (MyViewHolder) base_holder; // cast it
    final Reminder reminder_item = reminders.get(position);
    holder.position = position; // should we use getadapterposition instead?
    holder.title_text.setText(reminder_item.getTitle());


    String lastDetails = "";
    if (reminder_item.fired_times > 0) {
        if (JoH.msSince(reminder_item.last_fired) < Constants.DAY_IN_MS) {
            lastDetails += xdrip.getAppContext().getString(R.string.last) + " " + JoH.hourMinuteString(reminder_item.last_fired);
        } else {
            lastDetails += xdrip.getAppContext().getString(R.string.last) + " " + JoH.dateTimeText(reminder_item.last_fired);
        }
        lastDetails += " (x" + reminder_item.fired_times + ") " + xdrip.getAppContext().getString(R.string.next);
    }
    String nextDetails = "";
    if (reminder_item.enabled) {
        if (Math.abs(JoH.msSince(reminder_item.next_due)) < Constants.DAY_IN_MS) {
            nextDetails += JoH.hourMinuteString(reminder_item.next_due);
        } else {
            final String dstring = JoH.dateTimeText(reminder_item.next_due);
            nextDetails += dstring.substring(0, dstring.length() - 3); // remove seconds
        }
    }
    holder.small_text.setText(lastDetails + " " + nextDetails);

    final long duein = Math.max(JoH.msTill(reminder_item.next_due), JoH.msTill(reminder_item.snoozed_till));
    holder.wholeBlock.setBackgroundColor(Color.TRANSPARENT);
    String firstpart = "";
    if (reminder_item.enabled) {
        holder.wholeBlock.setAlpha(1.0f);
        if ((reminder_item.snoozed_till > JoH.tsl()) && (reminder_item.next_due < JoH.tsl())) {
            firstpart = xdrip.getAppContext().getString(R.string.snoozed_for) +" " + JoH.niceTimeTill(reminder_item.snoozed_till);
        } else {
            if (duein >= 0) {
                String natural_due = JoH.niceTimeScalarNatural(duein);
                if (natural_due.matches("^[0-9]+.*")) {
                    natural_due = xdrip.getAppContext().getString(R.string.in) + " " + natural_due;
                }
                firstpart = xdrip.getAppContext().getString(R.string.due) +" " + natural_due;
            } else {
                firstpart = xdrip.getAppContext().getString(R.string.due_uppercase) + " " + JoH.hourMinuteString(reminder_item.next_due);
                holder.wholeBlock.setBackgroundColor(Color.parseColor("#660066"));
                highlighted++;
            }
        }
    } else {
        firstpart = xdrip.getAppContext().getString(R.string.completed) + " ";
        holder.wholeBlock.setAlpha(0.3f);
    }
    holder.next_due_text.setText(firstpart + (reminder_item.repeating ? ", " + xdrip.getAppContext().getString(R.string.repeats_every) + " " + JoH.niceTimeScalarRedux(reminder_item.period) : ""));

}
 
Example 15
Source File: Reminder.java    From xDrip-plus with GNU General Public License v3.0 4 votes vote down vote up
public boolean isHoursPeriod() {
    return (period >= Constants.HOUR_IN_MS) && (period < Constants.DAY_IN_MS);
}
 
Example 16
Source File: Reminder.java    From xDrip-plus with GNU General Public License v3.0 4 votes vote down vote up
public boolean isDaysPeriod() {
    return (period >= Constants.DAY_IN_MS) && (period < (Constants.WEEK_IN_MS * 2));
}
 
Example 17
Source File: Reminders.java    From xDrip with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onBindViewHolder(final ActivityWithRecycler.MyViewHolder base_holder, int position) {
    final MyViewHolder holder = (MyViewHolder) base_holder; // cast it
    final Reminder reminder_item = reminders.get(position);
    holder.position = position; // should we use getadapterposition instead?
    holder.title_text.setText(reminder_item.getTitle());


    String lastDetails = "";
    if (reminder_item.fired_times > 0) {
        if (JoH.msSince(reminder_item.last_fired) < Constants.DAY_IN_MS) {
            lastDetails += xdrip.getAppContext().getString(R.string.last) + " " + JoH.hourMinuteString(reminder_item.last_fired);
        } else {
            lastDetails += xdrip.getAppContext().getString(R.string.last) + " " + JoH.dateTimeText(reminder_item.last_fired);
        }
        lastDetails += " (x" + reminder_item.fired_times + ") " + xdrip.getAppContext().getString(R.string.next);
    }
    String nextDetails = "";
    if (reminder_item.enabled) {
        if (Math.abs(JoH.msSince(reminder_item.next_due)) < Constants.DAY_IN_MS) {
            nextDetails += JoH.hourMinuteString(reminder_item.next_due);
        } else {
            final String dstring = JoH.dateTimeText(reminder_item.next_due);
            nextDetails += dstring.substring(0, dstring.length() - 3); // remove seconds
        }
    }
    holder.small_text.setText(lastDetails + " " + nextDetails);

    final long duein = Math.max(JoH.msTill(reminder_item.next_due), JoH.msTill(reminder_item.snoozed_till));
    holder.wholeBlock.setBackgroundColor(Color.TRANSPARENT);
    String firstpart = "";
    if (reminder_item.enabled) {
        holder.wholeBlock.setAlpha(1.0f);
        if ((reminder_item.snoozed_till > JoH.tsl()) && (reminder_item.next_due < JoH.tsl())) {
            firstpart = xdrip.getAppContext().getString(R.string.snoozed_for) +" " + JoH.niceTimeTill(reminder_item.snoozed_till);
        } else {
            if (duein >= 0) {
                String natural_due = JoH.niceTimeScalarNatural(duein);
                if (natural_due.matches("^[0-9]+.*")) {
                    natural_due = xdrip.getAppContext().getString(R.string.in) + " " + natural_due;
                }
                firstpart = xdrip.getAppContext().getString(R.string.due) +" " + natural_due;
            } else {
                firstpart = xdrip.getAppContext().getString(R.string.due_uppercase) + " " + JoH.hourMinuteString(reminder_item.next_due);
                holder.wholeBlock.setBackgroundColor(Color.parseColor("#660066"));
                highlighted++;
            }
        }
    } else {
        firstpart = xdrip.getAppContext().getString(R.string.completed) + " ";
        holder.wholeBlock.setAlpha(0.3f);
    }
    holder.next_due_text.setText(firstpart + (reminder_item.repeating ? ", " + xdrip.getAppContext().getString(R.string.repeats_every) + " " + JoH.niceTimeScalarRedux(reminder_item.period) : ""));

}
 
Example 18
Source File: PersistentHigh.java    From xDrip-plus with GNU General Public License v3.0 4 votes vote down vote up
public static boolean dataQualityCheck(final long since, final double highMarkMgDl) {

        final Sensor sensor = Sensor.currentSensor();
        if (sensor == null) {
            Log.e(TAG, "Cannot raise persistent high alert as no active sensor!");
            return false;
        }
        if (since < sensor.started_at) {
            Log.e(TAG, "Cannot raise persistent high alert as high time pre-dates sensor start");
            return false;
        }
        final long duration = msSince(since);
        if (duration > Constants.DAY_IN_MS || duration < 0) {
            Log.e(TAG, "Cannot raise persistent high alert as duration doesn't make sense: " + JoH.niceTimeScalar(duration));
            return false;
        }

        final List<BgReading> readings = BgReading.latestForSensorAsc(2000, since, JoH.tsl(), Home.get_follower());
        if (readings == null) {
            Log.e(TAG, "Cannot raise persistent high alert as there are no readings for this sensor!");
            return false;
        }

        final int numberOfReadings = readings.size();

        if (numberOfReadings == 0) {
            Log.e(TAG, "Cannot raise persistent high alert as there are 0 readings for this sensor!");
            return false;
        }

        final long frequency = duration / numberOfReadings;
        //Log.d(TAG, "Frequency Calculated as: " + frequency);
        if (frequency > MINUTE_IN_MS * 15) {
            Log.e(TAG, "Cannot raise persistent high alert as readings frequency is: " + niceTimeScalar(frequency));
            return false;
        }

        for (final BgReading bgr : readings) {
            if (bgr.getDg_mgdl() < highMarkMgDl) {
                Log.e(TAG, "High not persistent as reading at: " + JoH.dateTimeText(bgr.timestamp) + " does not exceed " + JoH.qs(highMarkMgDl) + " mgdl / high mark");
                return false;
            }
        }

        return true;

    }
 
Example 19
Source File: Reminder.java    From xDrip with GNU General Public License v3.0 4 votes vote down vote up
public boolean isHoursPeriod() {
    return (period >= Constants.HOUR_IN_MS) && (period < Constants.DAY_IN_MS);
}
 
Example 20
Source File: PersistentHigh.java    From xDrip with GNU General Public License v3.0 4 votes vote down vote up
public static boolean dataQualityCheck(final long since, final double highMarkMgDl) {

        final Sensor sensor = Sensor.currentSensor();
        if (sensor == null) {
            Log.e(TAG, "Cannot raise persistent high alert as no active sensor!");
            return false;
        }
        if (since < sensor.started_at) {
            Log.e(TAG, "Cannot raise persistent high alert as high time pre-dates sensor start");
            return false;
        }
        final long duration = msSince(since);
        if (duration > Constants.DAY_IN_MS || duration < 0) {
            Log.e(TAG, "Cannot raise persistent high alert as duration doesn't make sense: " + JoH.niceTimeScalar(duration));
            return false;
        }

        final List<BgReading> readings = BgReading.latestForSensorAsc(2000, since, JoH.tsl(), Home.get_follower());
        if (readings == null) {
            Log.e(TAG, "Cannot raise persistent high alert as there are no readings for this sensor!");
            return false;
        }

        final int numberOfReadings = readings.size();

        if (numberOfReadings == 0) {
            Log.e(TAG, "Cannot raise persistent high alert as there are 0 readings for this sensor!");
            return false;
        }

        final long frequency = duration / numberOfReadings;
        //Log.d(TAG, "Frequency Calculated as: " + frequency);
        if (frequency > MINUTE_IN_MS * 15) {
            Log.e(TAG, "Cannot raise persistent high alert as readings frequency is: " + niceTimeScalar(frequency));
            return false;
        }

        for (final BgReading bgr : readings) {
            if (bgr.getDg_mgdl() < highMarkMgDl) {
                Log.e(TAG, "High not persistent as reading at: " + JoH.dateTimeText(bgr.timestamp) + " does not exceed " + JoH.qs(highMarkMgDl) + " mgdl / high mark");
                return false;
            }
        }

        return true;

    }