Results 1 to 3 of 3

Thread: Scheduling long terms events in Qt

  1. #1
    Join Date
    Dec 2009
    Posts
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default Scheduling long terms events in Qt

    Hi,

    I'm designing an alarm clock type application in-house. The program will basically display a weekly schedule, and will allow users to enter an alarm to go off on a given day at a given time. The current implementation uses QTimer objects that are to go off on that date. I manually calculate the amount of days, hours, and minutes to add to the current date and time, and then find the delta between the target date and time and the current date and time.

    Of course, this implementation has many flaws; for example, if the user changes the system date or time, then the timers all need to be updated. My question is: is there a better way to do this?

    I'm trying to target Windows, Linux and Mac, so I'm trying to keep the code as portable as possible. Does anyone have any suggestions?

    Thank you!

  2. #2
    Join Date
    Apr 2010
    Posts
    769
    Thanks
    1
    Thanked 94 Times in 86 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Scheduling long terms events in Qt

    Do everything in GMT.

  3. #3
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Scheduling long terms events in Qt

    Why calculate everything?

    Use one timer and a QDateTime object for each alarm date.
    In the slot connected to the timer timeout signal, compare the currentdate and time to the list of QDateTime object (alarm dates). When one matches, handle it.

Similar Threads

  1. Scheduling
    By stevey in forum Qt Programming
    Replies: 2
    Last Post: 18th June 2011, 06:31
  2. long query executing
    By banita in forum Qt Programming
    Replies: 11
    Last Post: 11th October 2010, 00:38
  3. Cron or Quartz-like event scheduling?
    By davelowndes in forum Qt Programming
    Replies: 3
    Last Post: 15th August 2010, 22:22
  4. Very very long Plot
    By BobTheProg in forum Qwt
    Replies: 2
    Last Post: 27th January 2010, 17:02
  5. what to do during long calculation?
    By Weilor in forum Qt Programming
    Replies: 4
    Last Post: 14th September 2007, 12:11

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.