Boost C++ Libraries: Ticket #6898: Compiler warning when using boost::posix_time::from_ftime. https://svn.boost.org/trac10/ticket/6898 <p> VC2005 compiler reports a compilation warning when using from_time function. </p> <p> 1&gt;c:\workspace\boost\boost\date_time\filetime_functions.hpp(146) : warning C4244: 'initializing' : conversion from 'boost::uint64_t' to 'boost::uint32_t', possible loss of data 1&gt; c:\workspace\boost\boost\date_time\posix_time\conversion.hpp(81) : see reference to function template instantiation 'TimeT boost::date_time::time_from_ftime&lt;TimeT,FileTimeT&gt;(const FileTimeT &amp;)' being compiled 1&gt; with 1&gt; [ 1&gt; TimeT=boost::posix_time::ptime, 1&gt; FileTimeT=FILETIME 1&gt; ] 1&gt; c:\workspace\blah\rainbowkeyimpl.cpp(126) : see reference to function template instantiation 'TimeT boost::posix_time::from_ftime&lt;boost::posix_time::ptime,FILETIME&gt;(const FileTimeT &amp;)' being compiled 1&gt; with 1&gt; [ 1&gt; TimeT=boost::posix_time::ptime, 1&gt; FileTimeT=FILETIME 1&gt; ] </p> <p> Looking the code in the latest Boost version the line that the warning is pointing hasn't changed. </p> <pre class="wiki">uint32_t sub_sec = (caster.as_integer % 10000000UL) #if !defined(BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG) / 10; // microseconds since the last second #else * 100; // nanoseconds since the last second #endif </pre><p> A quick way to resolve it would be to static_cast&lt;uint32_t&gt; the results. The cast shouldn't cause any data loss as the mod is and the multiplication are keeping the maximum value within the uint32_t range. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/6898 Trac 1.4.3 anonymous Mon, 14 May 2012 11:55:21 GMT <link>https://svn.boost.org/trac10/ticket/6898#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6898#comment:1</guid> <description> <p> Sorry my last sentence was meant to say: ...the mod and the multiplication are keeping </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Wed, 15 Aug 2012 13:59:47 GMT</pubDate> <title>description changed https://svn.boost.org/trac10/ticket/6898#comment:2 https://svn.boost.org/trac10/ticket/6898#comment:2 <ul> <li><strong>description</strong> modified (<a href="/trac10/ticket/6898?action=diff&amp;version=2">diff</a>) </li> </ul> Ticket James E. King, III Wed, 27 Dec 2017 15:35:49 GMT owner, milestone changed https://svn.boost.org/trac10/ticket/6898#comment:3 https://svn.boost.org/trac10/ticket/6898#comment:3 <ul> <li><strong>owner</strong> changed from <span class="trac-author">az_sw_dude</span> to <span class="trac-author">Andrey Semashev</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.66.0</span> </li> </ul> Ticket James E. King, III Wed, 27 Dec 2017 15:36:10 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/6898#comment:4 https://svn.boost.org/trac10/ticket/6898#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> This was fixed in 1.66.0: </p> <p> <a class="ext-link" href="https://github.com/boostorg/date_time/commit/e9ddfa6400e84a854bace5a05fb19da9265426d5"><span class="icon">​</span>https://github.com/boostorg/date_time/commit/e9ddfa6400e84a854bace5a05fb19da9265426d5</a> </p> Ticket