Results 1 to 5 of 5

Thread: timer callback greater than 2 power 31

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Angry Re: timer callback greater than 2 power 31

    Hi,

    I think that you can use a QTimer to fire up to 49 days:
    The QTimer needs miliseconds

    2^32 = 4294967296 maximum miliseconds
    4294967296 / 1000 = 4294967,296 seconds
    4294967 / 60 = 71582,7882 minutes
    71582,7882 / 60 = 1193,04 hours
    1193,04 / 24 = 49,7 days

    It is not enough you can also fire the timer every day and when it's fired you can use a counter to check if "days" have been passed.
    Òscar Llarch i Galán

  2. #2
    Join Date
    Mar 2009
    Posts
    19
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: timer callback greater than 2 power 31

    Hi,

    Yes you are correct but I was looking timer event callback for specific date, like for example a reminder or an anniversary notification to be popped up. Actually I need it because
    the Qtimer::start(int) is limited on s60 as the internal timer class takes int microseconds as input so you cannot feed maximum of int in the start as what ever is fed is multiplied 1000 to make it to microseconds

    for example you want 32 seconds you feed
    QTimer::start(32*1000);

    internally it becomes
    32*1000*1000.

    now if you feed max of integer which is 2 ^ 31 = 2147483648;

    internally it become 2147483648*1000 signed integer overflows.

    So I need a different mechanism where I could request the timer server give me a callback at the specific time, so that I could avoid this problem.

    -Srikanth

  3. #3
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: timer callback greater than 2 power 31

    Hi,

    Create a timer fired every second and compare dates there.
    Òscar Llarch i Galán

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
  •  
Qt is a trademark of The Qt Company.