<?xml version="1.0" encoding="UTF-8" standalone="yes"?><oembed><version><![CDATA[1.0]]></version><provider_name><![CDATA[Krzysztof Narkowicz]]></provider_name><provider_url><![CDATA[https://knarkowicz.wordpress.com]]></provider_url><author_name><![CDATA[Krzysztof Narkowicz]]></author_name><author_url><![CDATA[https://knarkowicz.wordpress.com/author/knarkowicz/]]></author_url><title><![CDATA[Visual C++ linker&nbsp;timestamp]]></title><type><![CDATA[link]]></type><html><![CDATA[<p>Nice trick to get build&#8217;s <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms680313(v=vs.85).aspx">timestamp</a> at runtime (Visual C++ only):</p>
<pre class="brush: cpp; title: ; notranslate" title="">&lt;/pre&gt;
EXTERN_C IMAGE_DOS_HEADER __ImageBase;

(...)

IMAGE_NT_HEADERS const* ntHeader
= (IMAGE_NT_HEADERS*) ( (char*) &amp;__ImageBase + __ImageBase.e_lfanew );
DWORD const timeStamp = ntHeader-&gt;FileHeader.TimeDateStamp;
&lt;pre&gt;</pre>
<p>It&#8217;s not very portable, but it doesn&#8217;t require any additional recompilation (as __DATE__ __TIME__ macros do).</p>
]]></html></oembed>