Results 1 to 2 of 2

Thread: [SOLVED] QDateTime (revisited)

  1. #1
    Join Date
    Jan 2008
    Posts
    107
    Thanks
    36
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Red face [SOLVED] QDateTime (revisited)

    Hi,

    I have this 32 bit value which represents the number of seconds since 1989-12-31 00:00:00

    Looking at the fxs:
    toTime_t ()
    fromTime_t ()

    Their starting date is 1970-01-01T00:00:00

    I've tried:
    Qt Code:
    1. QDateTime dateTime;
    2. QDateTime dateTimeStart;
    3.  
    4. //! \note Date/Time starts at 1989-12-31 00:00:00
    5. dateTimeStart = QDateTime::fromString("M12d31y8900:00:00", "'M'M'd'd'y'yyhh:mm:ss");
    6. quint16 start = dateTimeStart.toTime_t();
    7.  
    8. dateTime=QDateTime::fromTime_t ( driver_id_data.status_change_time + start );
    9. humanDate = dateTime.toString ( "yyyy-MM-dd hh:mm:ss" );
    To copy to clipboard, switch view to plain text mode 

    This obviously fails due to the nature of fromTime_t() and toTime_t() ...

    So the real question here is:
    How can I add that 32 bit value to dateTimeStart ?

    TIA,
    Pedro Doria Meunier
    Last edited by pdoria; 31st July 2009 at 13:53.

  2. #2
    Join Date
    Jan 2008
    Posts
    107
    Thanks
    36
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Red face Re: QDateTime (revisited)

    ooooops! My bad!

    I should have :
    Qt Code:
    1. quint32 start = dateTimeStart.toTime_t();
    To copy to clipboard, switch view to plain text mode 

    instead of:
    Qt Code:
    1. quint16 start = dateTimeStart.toTime_t();
    To copy to clipboard, switch view to plain text mode 

    Deeply sorry for the noise ...

    BR,
    Pedro.

Similar Threads

  1. QDateTime Invalid
    By FreePascal in forum Newbie
    Replies: 2
    Last Post: 7th June 2009, 19:35
  2. QDateTime GMT add sec. or - sec. from locale time....
    By patrik08 in forum Qt Programming
    Replies: 2
    Last Post: 20th February 2007, 16:39
  3. Replies: 1
    Last Post: 30th June 2006, 05:24
  4. Invite QDateTime to go 8 secs on future uint
    By patrik08 in forum Newbie
    Replies: 4
    Last Post: 6th June 2006, 23:26
  5. Upper case in QDateTime !!!!
    By paranoid_android in forum Qt Programming
    Replies: 4
    Last Post: 15th March 2006, 08:38

Tags for this Thread

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.