Results 1 to 3 of 3

Thread: Qtime compare

  1. #1
    Join Date
    Mar 2010
    Location
    spain
    Posts
    25
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Qtime compare

    As you can compare two QTime?

    Qt Code:
    1. if(QTime::currentTime()== QTime(23,45,00)) //not working
    To copy to clipboard, switch view to plain text mode 


    thanks

  2. #2
    Join Date
    Dec 2008
    Location
    France
    Posts
    93
    Thanked 23 Times in 22 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android

    Default Re: Qtime compare

    QTime has a milisec precision so the comparaison with between 23:45:00.000 and the current time should failled.
    You can use secsTo() member of QTime, if the result is 0 then you got the same time.

  3. The following user says thank you to nix for this useful post:

    valgaba (6th September 2013)

  4. #3
    Join Date
    Mar 2010
    Location
    spain
    Posts
    25
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qtime compare

    ok perfect
    Qt Code:
    1. if(QTime::currentTime().secsTo(QTime(12,00,00))==0)
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. functions in QTime
    By mythili in forum Qt Programming
    Replies: 1
    Last Post: 14th June 2013, 08:06
  2. QTime
    By dragon in forum Newbie
    Replies: 12
    Last Post: 16th February 2012, 10:40
  3. Help me qtime in qt?
    By tamnv110 in forum Newbie
    Replies: 7
    Last Post: 16th June 2011, 11:59
  4. QTime error?
    By roxton in forum Qt Programming
    Replies: 2
    Last Post: 19th October 2010, 22:06
  5. QTime
    By bismitapadhy in forum Qt Programming
    Replies: 1
    Last Post: 26th June 2009, 05:21

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.