[Interest] Relashionship between time_t and QDateTime

Calogero Mauceri mauceri at actgate.com
Mon Aug 26 17:42:58 CEST 2013


Hi all,

I'm facing the following problem when initializing a QDateTime with 
time_t value.
I get the last modified timestamp of a file as time_t value

...
     time_t mtime;
     struct stat statbuf;
     fstat(fd, &statbuf);
     mtime = statbuf.st_mtime;
     ...

Then I use that mtime value to initialize a QDateTime as follows:

QDateTime myDateTime = QDateTime::fromTime_t(f_mtime);

The date time printed doing a myDateTime.toString() is

     Wed Dec 5 12:36:18 2007


Retrieving the last modified information using QFileInfo, the result is 
different

     QFileInfo fi(filepath);
     QDateTime myDateTime = fi.lastModified();

I get this result

     Wed Dec 5 11:36:18 2007

That is there is one hour difference. I guess the difference is due to 
the daylight saving management,
but I can not understand how that management is performed.

Note: if I look at the file properties on Windows dialog, the last 
modified time is shown as

     Wed Dec 5 12:36:18 2007



Thanks in advance for your help.
     Calogero

-- 
Calogero Mauceri
Software Engineer

Applied Coherent Technology Corporation (ACT)
www.actgate.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130826/8364d9f8/attachment.html>


More information about the Interest mailing list