public boolean isSnoozed() { if (snoozed_till > JoH.tsl()) { return true; } else { return false; } }
private GCM_data(Bundle data) { bundle = data; timestamp = JoH.tsl(); resent = 0; } }
public static synchronized boolean ratelimit(String name, int seconds) { // check if over limit if ((rateLimits.containsKey(name)) && (JoH.tsl() - rateLimits.get(name) < (seconds * 1000L))) { Log.d(TAG, name + " rate limited: " + seconds + " seconds"); return false; } // not over limit rateLimits.put(name, JoH.tsl()); return true; }
public static LibreData create(byte[] temp_bytes) { final LibreData ld = new LibreData(); ld.timestamp = JoH.tsl(); // TODO //ld.temperatureraw = get byte order value from temp_bytes //ld.temperature = evaluate temperature from temperature raw return ld; }
public synchronized void schedule_next() { this.next_due = this.next_due + this.period; // check it is actually in the future while (this.next_due < JoH.tsl()) { this.next_due = this.next_due + this.period; } if (alternating) alternate = !alternate; alerted_times = 0; // reset counter save(); }
public static String hourMinuteString() { // Date date = new Date(); // SimpleDateFormat sd = new SimpleDateFormat("HH:mm"); // return sd.format(date); return hourMinuteString(JoH.tsl()); }
public static boolean outsideWindow(final String transmitterId) { final long now = JoH.tsl(); final long next = anticipate(transmitterId, now); return next != now; }
public static void deleteRandomData() { Random rand = new Random(); int minutes_ago_end = rand.nextInt(120); int minutes_ago_start = minutes_ago_end + rand.nextInt(35)+5; long ts_start = JoH.tsl() - minutes_ago_start * Constants.MINUTE_IN_MS; long ts_end = JoH.tsl() - minutes_ago_end * Constants.MINUTE_IN_MS; UserError.Log.d(TAG,"Deleting random bgreadings: "+JoH.dateTimeText(ts_start)+" -> "+JoH.dateTimeText(ts_end)); testDeleteRange(ts_start, ts_end); }
@NonNull public static String extraStatusLine() { if (JoH.msSince(cacheTime) > Constants.SECOND_IN_MS * 5) { cache = extraStatusLineReal(); cacheTime = JoH.tsl(); if (D) UserError.Log.d(TAG, "Cache Miss"); } else { if (D) UserError.Log.d(TAG, "Cache Hit"); } return cache; }
public long getRealSessionStartTime() { if (sessionInProgress()) { return getRealSessionStartTime(JoH.tsl()); } else { return -1; } }
private synchronized static void Seen(RollCall item) { // sanity check object contains some data if (item == null) return; if ((item.android_version == null) || (item.android_version.length() == 0)) return; if (indexed == null) loadIndex(); indexed.put(item.getHash(), item); item.last_seen = JoH.tsl(); saveIndex(); }
public SetTimeTx() { init(getNext(), 7); data.put(Const.DONT_REQUEST_RESULT); data.put(Const.OPCODE_SET_TIME_ALT); data.putInt((int) ((JoH.tsl() / 1000) + getTimeZoneOffsetSeconds())); data.put(getTimeZoneOffsetByte()); appendFooter(); }
private static void updateStreamedTillTimeForBackfill() { // interact with ListenerService if (JoH.areWeRunningOnAndroidWear()) { final String pref_last_send_previous = "last_send_previous"; final long last_send_previous = PersistentStore.getLong(pref_last_send_previous); PersistentStore.setLong(pref_last_send_previous, Math.min(last_send_previous, JoH.tsl() - MAX_BACKFILL_PERIOD_MS)); } }
public static void poll(final boolean hint) { if (!enabled()) return; lastLocalReception = JoH.tsl(); Inevitable.task("mimeograph poll", 2000, () -> pollTask(hint)); }
public static Sensor createDefaultIfMissing() { final Sensor sensor = currentSensor(); if (sensor == null) { Sensor.create(JoH.tsl()); } return currentSensor(); }
private void setFailOverTimer() { if (Home.get_follower()) { final long retry_in = (5 * 60 * 1000); UserError.Log.d(TAG, "setFailoverTimer: Restarting in: " + (retry_in / (60 * 1000)) + " minutes"); nextWakeUpTime = JoH.tsl() + retry_in; //final PendingIntent wakeIntent = PendingIntent.getService(this, 0, new Intent(this, this.getClass()), 0); final PendingIntent wakeIntent = WakeLockTrampoline.getPendingIntent(this.getClass()); JoH.wakeUpIntent(this, retry_in, wakeIntent); } else { stopSelf(); } }
@Override public void onDataReceived(TransportDataItem item) { if (item.getAction().equals("Amazfit_Healthdata")) { DataBundle databundle = item.getData(); final StepCounter pm = StepCounter.createEfficientRecord(JoH.tsl(), databundle.getInt("steps")); HeartRate.create(JoH.tsl(), databundle.getInt("heart_rate"), databundle.getInt("heart_acuracy")); } else UserError.Log.e("Amazfitservice", item.getAction()); }
public static List<BloodTest> cleanup(int retention_days) { return new Delete() .from(BloodTest.class) .where("timestamp < ?", JoH.tsl() - (retention_days * Constants.DAY_IN_MS)) .execute(); }
static void scheduleWakeUp() { final BgReading lastBg = BgReading.lastNoSenssor(); final long last = lastBg != null ? lastBg.timestamp : 0; final long grace = Constants.SECOND_IN_MS * 10; final long next = Anticipate.next(JoH.tsl(), last, SAMPLE_PERIOD, grace) + grace; UserError.Log.d(TAG, "Anticipate next: " + JoH.dateTimeText(next) + " last: " + JoH.dateTimeText(last)); JoH.wakeUpIntent(xdrip.getAppContext(), JoH.msTill(next), WakeLockTrampoline.getPendingIntent(NightscoutFollowService.class, Constants.NSFOLLOW_SERVICE_FAILOVER_ID)); }