[sleepphasealarm] Update to new time_utils module

pull/1822/head
Alessandro Cocco 2022-05-12 22:51:41 +02:00
parent 94690a81ee
commit ee663ef169
3 changed files with 4 additions and 3 deletions

View File

@ -6,3 +6,4 @@
0.06: Add logging 0.06: Add logging
use Layout library and display ETA use Layout library and display ETA
0.07: Add check for day of week 0.07: Add check for day of week
0.08: Update to new time_utils module

View File

@ -46,8 +46,8 @@ function calc_ess(acc_magn) {
var nextAlarm; var nextAlarm;
active.forEach(alarm => { active.forEach(alarm => {
const now = new Date(); const now = new Date();
const t = require("sched").decodeTime(alarm.t); const time = require("time_utils").decodeTime(alarm.t);
var dateAlarm = new Date(now.getFullYear(), now.getMonth(), now.getDate(), t.hrs, t.mins); var dateAlarm = new Date(now.getFullYear(), now.getMonth(), now.getDate(), time.h, time.m);
if (dateAlarm < now) { // dateAlarm in the past, add 24h if (dateAlarm < now) { // dateAlarm in the past, add 24h
dateAlarm.setTime(dateAlarm.getTime() + (24*60*60*1000)); dateAlarm.setTime(dateAlarm.getTime() + (24*60*60*1000));
} }

View File

@ -2,7 +2,7 @@
"id": "sleepphasealarm", "id": "sleepphasealarm",
"name": "SleepPhaseAlarm", "name": "SleepPhaseAlarm",
"shortName": "SleepPhaseAlarm", "shortName": "SleepPhaseAlarm",
"version": "0.07", "version": "0.08",
"description": "Uses the accelerometer to estimate sleep and wake states with the principle of Estimation of Stationary Sleep-segments (ESS, see https://ubicomp.eti.uni-siegen.de/home/datasets/ichi14/index.html.en). This app will read the next alarm from the alarm application and will wake you up to 30 minutes early at the best guessed time when you are almost already awake.", "description": "Uses the accelerometer to estimate sleep and wake states with the principle of Estimation of Stationary Sleep-segments (ESS, see https://ubicomp.eti.uni-siegen.de/home/datasets/ichi14/index.html.en). This app will read the next alarm from the alarm application and will wake you up to 30 minutes early at the best guessed time when you are almost already awake.",
"icon": "app.png", "icon": "app.png",
"tags": "alarm", "tags": "alarm",