<p>As far as I understand the description of QDateTime::fromTime_t(), it automatically converts the passed value from UTC to local time. On the other hand, QFileInfo::lastModified() may immediately return the value retrieved from the system without any transformations.</p>

<div class="gmail_quote">On Aug 26, 2013 7:43 PM, "Calogero Mauceri" <<a href="mailto:mauceri@actgate.com">mauceri@actgate.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

  

    
  
  <div text="#000000" bgcolor="#FFFFFF">
    Hi all,<br>
    <br>
    I'm facing the following problem when initializing a QDateTime with
    time_t value.<br>
    I get the last modified timestamp of a file as time_t value<br>
    <br>
            <tt>...</tt><tt><br>
    </tt><tt>    time_t mtime;</tt><tt><br>
    </tt><tt>    struct stat statbuf;</tt><tt><br>
    </tt><tt>    fstat(fd, &statbuf);</tt><tt><br>
    </tt><tt>    mtime = statbuf.st_mtime;</tt><tt><br>
    </tt><tt>    ...</tt><br>
    <br>
    Then I use that mtime value to initialize a QDateTime as follows:<br>
    <br>
    <tt>    </tt><tt>QDateTime myDateTime = QDateTime::fromTime_t(f_</tt><tt><tt>mtime</tt>);</tt><br>
    <br>
    The date time printed doing a myDateTime.toString() is<br>
    <br>
    <span style="font-family:'Courier New,courier'"> <tt>    Wed Dec
        5 12:36:18 2007</tt></span><br>
    <br>
    <br>
    Retrieving the last modified information using QFileInfo, the result
    is different<br>
    <br>
    <tt>    QFileInfo fi(filepath);</tt><tt><br>
    </tt><tt>    QDateTime myDateTime = fi.lastModified();</tt><br>
    <br>
    I get this result<br>
    <br>
    <tt>    Wed Dec 5 11:36:18 2007</tt><br>
    <br>
    That is there is one hour difference. I guess the difference is due
    to the daylight saving management,<br>
    but I can not understand how that management is performed.<br>
    <br>
    Note: if I look at the file properties on Windows dialog, the last
    modified time is shown as<br>
    <br>
    <span style="font-family:'Courier New,courier'"><tt>    Wed Dec 5
        12:36:18 2007</tt></span><br>
    <br>
    <br>
    <br>
    Thanks in advance for your help.<br>
        Calogero<br>
    <pre cols="72">-- 
Calogero Mauceri
Software Engineer

Applied Coherent Technology Corporation (ACT)
<a href="http://www.actgate.com" target="_blank">www.actgate.com</a></pre>
  </div>

<br>_______________________________________________<br>
Interest mailing list<br>
<a href="mailto:Interest@qt-project.org">Interest@qt-project.org</a><br>
<a href="http://lists.qt-project.org/mailman/listinfo/interest" target="_blank">http://lists.qt-project.org/mailman/listinfo/interest</a><br>
<br></blockquote></div>