1 <span class="co2">#include <stdio.h></span>
2 <span class="co2">#include <time.h></span>
4 <span class="kw4">int</span> main<span class="br0">(</span><span class="br0">)</span>
5 <span class="br0">{</span>
6 time_t currtime<span class="sy0">;</span>
7 <span class="kw4">char</span> charTime<span class="br0">[</span>100<span class="br0">]</span> <span class="sy0">=</span> <span class="br0">{</span>0<span class="br0">}</span><span class="sy0">;</span>
8 time<span class="br0">(</span><span class="sy0">&</span>currtime<span class="br0">)</span><span class="sy0">;</span>
9 strftime<span class="br0">(</span>charTime<span class="sy0">,</span><span class="kw4">sizeof</span><span class="br0">(</span>charTime<span class="br0">)</span><span class="sy0">-</span><span class="nu0">1</span><span class="sy0">,</span><span class="st0">"%c"</span><span class="sy0">,</span>localtime<span class="br0">(</span><span class="sy0">&</span>currtime<span class="br0">)</span><span class="br0">)</span><span class="sy0">;</span>
10 <a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html"><span class="kw3">printf</span></a><span class="br0">(</span><span class="st0">"time: %s<span class="es1">\n</span>"</span><span class="sy0">,</span> charTime<span class="br0">)</span><span class="sy0">;</span>
11 <span class="coMULTI">/* "time: Sat Apr 17 11:43:47 2010" */</span>
12 <span class="br0">}</span>