Results 1 to 5 of 5

Thread: QFileInfo::lastModified seems to be one hour off

  1. #1
    Join Date
    May 2006
    Posts
    58
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default QFileInfo::lastModified seems to be one hour off

    I have a QT program that has been functioning properly in Windows for a few months, but recently (after the DST shift maybe?) started acting strangely. I have the following function:

    Qt Code:
    1. QDateTime frmMain::GetLocalStamp( QString sFilename, bool *pbSuccess ) {
    2. QDateTime obStamp;
    3.  
    4. QFileInfo obFileInfo(sFilename);
    5. if (!obFileInfo.exists() ) {
    6. qDebug() << "File " << sFilename << " does not exist, no local stamp";
    7. *pbSuccess = false;
    8. return( obStamp );
    9. }
    10.  
    11. //qDebug() << "Checking local stamp on " << sFilename;
    12.  
    13. obStamp = obFileInfo.lastModified();
    14.  
    15. *pbSuccess = true;
    16. return( obStamp );
    17. } //GetLocalStamp
    To copy to clipboard, switch view to plain text mode 

    If I qDebug() the returned QDateTime object, it is one hour off from the time the Operating system reports. Is this a known issue, or is there some step I am missing?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QFileInfo::lastModified seems to be one hour off

    What does obStamp.timeSpec() return?

  3. #3
    Join Date
    May 2006
    Posts
    58
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QFileInfo::lastModified seems to be one hour off

    Quote Originally Posted by jacek View Post
    What does obStamp.timeSpec() return?
    0 (Qt::LocalTime)

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QFileInfo::lastModified seems to be one hour off

    I couldn't find anything in Trolltech's task tracker, so I think it will be better if you prepare a minimal compilable example and contact the Trolls.

  5. #5
    Join Date
    May 2006
    Posts
    58
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QFileInfo::lastModified seems to be one hour off

    Quote Originally Posted by jacek View Post
    I couldn't find anything in Trolltech's task tracker, so I think it will be better if you prepare a minimal compilable example and contact the Trolls.
    This is starting to look like a Windows issue more than a QT issue. I am setting the timestamp of the file myself using utime in another part of the code (this program downloads updates off of the Internet, sets their timestamp to the server timestamp, and upon subsequent executions, compares client-side stamps to server-side stamps).



    Check out this screen shot...I ran a little test app to show the modify time of two executables, and I am getting two different results, even though Windows is showing an identical modify time. What is even stranger is that neither result I get from the QT call is the same as what Windows reports, however, the 16:14 time is what I tried to set it to with utime (this file is a copy and paste of the file I downloaded.)

    Is there something "under the hood" of the stamps that could be causing this? Do Windows files have any sort of meta-info that may be scrambling this?

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.