Event scheduling past next 24 hours

Posted on
  • As it stands the scheduling library is highly alarm focused.

    Would it make sense to extend it to encompass the scheduling of events with absolute timestamps?

    Potential benefits:

    1. Countdown timers would gain the ability to schedule more than 24 hours out and accurate negative time.
    2. Persistent stopwatches.
    3. Syncing of calendar events.
    4. Place for apps to push events such as sunrise and sunset.
  • You can set a date on which to fire as well as the time? https://github.com/espruino/BangleApps/b­lob/master/apps/sched/README.md#internal­s--library

    So as far as I can see, really the only issue is rather than specifying a full timestamp when you schedule the alarm, you have to specify a date and then the time offset on that date - but it seems that's pretty easily to do without having to change the way the library works?

    Or is it just that the examples on that page only show the use of:

    require("sched").setAlarm("mytimer", {
      msg : "Wake up",
      timer : 10 * 60 * 1000 // 10 minutes
    });
    

    and not:

    require("sched").setAlarm("mytimer", {
      msg : "Wake up",
      t : 9 * 3600000 // 9 o'clock (in ms)
    });
    

    and:

    require("sched").setAlarm("mytimer", {
      msg : "Wake up",
      date : "2022-04-04",
      t : 9 * 3600000 // 9 o'clock (in ms)
    });
    
  • I had no idea adding a date was a possibility. Not sure how I missed it, may have been the visual offset from "msg" that put it in the day of week section in my head. Possibly also carryover expectations from when I last looked the alarm app.

    I have to dig into it but it should cover my use cases.

    The only concern would be whether applications that don't handle dates may be confused.

  • Ok, great! I'll update the README now to make it clearer

    The only concern would be whether applications that don't handle dates may be confused.

    Hopefully not, because if they use the library functions to find out how long until the alarm runs, they should be ok.

    But if you find one that breaks, we need to fix it :)

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Event scheduling past next 24 hours

Posted by Avatar for Subtlewolf @Subtlewolf

Actions