<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[ZEIT Ausgeben]]></title><description><![CDATA[<p>Hi Leute,</p>
<p>Ich wollte mal wissen, ob es in der <strong>iostream</strong><br />
auch eine Funktion zum holen und ausgeben der Zeit gibt.</p>
<p>Wenn ja welche?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/189915/zeit-ausgeben</link><generator>RSS for Node</generator><lastBuildDate>Fri, 25 Sep 2026 16:13:47 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/189915.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 18 Aug 2007 13:55:01 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to ZEIT Ausgeben on Sat, 18 Aug 2007 13:55:01 GMT]]></title><description><![CDATA[<p>Hi Leute,</p>
<p>Ich wollte mal wissen, ob es in der <strong>iostream</strong><br />
auch eine Funktion zum holen und ausgeben der Zeit gibt.</p>
<p>Wenn ja welche?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1346928</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1346928</guid><dc:creator><![CDATA[crackmaster]]></dc:creator><pubDate>Sat, 18 Aug 2007 13:55:01 GMT</pubDate></item><item><title><![CDATA[Reply to ZEIT Ausgeben on Sat, 18 Aug 2007 13:58:57 GMT]]></title><description><![CDATA[<p>selber nachschauen <a href="http://www.cplusplus.com/reference/iostream/iostream/" rel="nofollow">http://www.cplusplus.com/reference/iostream/iostream/</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1346932</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1346932</guid><dc:creator><![CDATA[wäre komisch]]></dc:creator><pubDate>Sat, 18 Aug 2007 13:58:57 GMT</pubDate></item><item><title><![CDATA[Reply to ZEIT Ausgeben on Sat, 18 Aug 2007 15:17:21 GMT]]></title><description><![CDATA[<p>nope ... Header &lt;ctime&gt; hat die Zeitfunktionen drin ...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1346967</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1346967</guid><dc:creator><![CDATA[*D*Evil]]></dc:creator><pubDate>Sat, 18 Aug 2007 15:17:21 GMT</pubDate></item><item><title><![CDATA[Reply to ZEIT Ausgeben on Sat, 18 Aug 2007 15:45:07 GMT]]></title><description><![CDATA[<p>hab da mal was vorbereitet <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
<pre><code class="language-cpp">// und #include &lt;ctime&gt; oder #include &lt;time.h&gt; net vergessen ;)

char *timeStamp( ) {

    time_t stamp;
    tm *now;

    char szBufferTime[ 16 ];
    char szBufferHour[ 4 ];
    char szBufferMin[ 4 ];
    char szBufferSec[ 4 ];

    stamp = time( 0 );
    now = localtime( &amp;stamp );

    szBufferHour[ 0 ] = 0;
    if( now-&gt;tm_hour &lt; 10 ) {

        char szBh[ 4 ];
            szBh[ 0 ] = 0;

        sprintf( szBh, &quot;%d&quot;, now-&gt;tm_hour );
        strcat( szBufferHour, &quot;0&quot; );
        strcat( szBufferHour, szBh );
    }
    else {

        sprintf( szBufferHour, &quot;%d&quot;, now-&gt;tm_hour );
    }

    szBufferMin[ 0 ] = 0;
    if( now-&gt;tm_min &lt; 10 ) {

        char szBm[ 4 ];
            szBm[ 0 ] = 0;

        sprintf( szBm, &quot;%d&quot;, now-&gt;tm_min );
        strcat( szBufferMin, &quot;0&quot; );
        strcat( szBufferMin, szBm );
    }
    else {

        sprintf( szBufferMin, &quot;%d&quot;, now-&gt;tm_min );
    }

    szBufferSec[ 0 ] = 0;
    if( now-&gt;tm_sec &lt; 10 ) {

        char szBs[ 4 ];
            szBs[ 0 ] = 0;

        sprintf( szBs, &quot;%d&quot;, now-&gt;tm_sec );
        strcat( szBufferSec, &quot;0&quot; );
        strcat( szBufferSec, szBs );
    }
    else {

        sprintf( szBufferSec, &quot;%d&quot;, now-&gt;tm_sec );
    }

    szBufferTime[ 0 ] = 0;
    strcat( szBufferTime, szBufferHour );
    strcat( szBufferTime, &quot;:&quot; );
    strcat( szBufferTime, szBufferMin );
    strcat( szBufferTime, &quot;:&quot; );
    strcat( szBufferTime, szBufferSec );

    return( (char *)szBufferTime );
}
</code></pre>
<p>hoffe es hilft dir,</p>
<p>Gruß Tobi.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1346987</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1346987</guid><dc:creator><![CDATA[T0bi]]></dc:creator><pubDate>Sat, 18 Aug 2007 15:45:07 GMT</pubDate></item><item><title><![CDATA[Reply to ZEIT Ausgeben on Sat, 18 Aug 2007 15:57:43 GMT]]></title><description><![CDATA[<p>Du kennst aber schon strftime ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1346992</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1346992</guid><dc:creator><![CDATA[*D*Evil]]></dc:creator><pubDate>Sat, 18 Aug 2007 15:57:43 GMT</pubDate></item><item><title><![CDATA[Reply to ZEIT Ausgeben on Sat, 18 Aug 2007 16:13:34 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">std::ostream&amp; operator&lt;&lt;(std::ostream&amp; stream, const std::tm&amp; obj)
{
    char arr[64];
    std::strftime(arr, 64, &quot;%A, %x - %X&quot;);
    stream &lt;&lt; arr;
    return stream;
}
</code></pre>
<pre><code class="language-cpp">std::cout &lt;&lt; std::localtime(std::time(0)) &lt;&lt; std::endl;
</code></pre>
<p>...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1347000</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1347000</guid><dc:creator><![CDATA[*D*Evil]]></dc:creator><pubDate>Sat, 18 Aug 2007 16:13:34 GMT</pubDate></item><item><title><![CDATA[Reply to ZEIT Ausgeben on Sat, 18 Aug 2007 17:47:35 GMT]]></title><description><![CDATA[<p>T0bi schrieb:</p>
<blockquote>
<pre><code class="language-cpp">char *timeStamp( ) {
    char szBufferTime[ 16 ];
...
    return( (char *)szBufferTime );
}
</code></pre>
</blockquote>
<p>das geht nicht gut... da müsste eigentlich auch der Compiler warnen, von wegen 'returning reference to temporary' oder so.</p>
<p>Entweder szBufferTime statisch machen oder mit malloc dauerhaften Speicher anfordnern.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1347036</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1347036</guid><dc:creator><![CDATA[DrGreenthumb]]></dc:creator><pubDate>Sat, 18 Aug 2007 17:47:35 GMT</pubDate></item><item><title><![CDATA[Reply to ZEIT Ausgeben on Sun, 19 Aug 2007 08:24:18 GMT]]></title><description><![CDATA[<p>Danke für Eure Antworten ich werde mal schauen was mir am besten weiter hilft<br />
<img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1347201</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1347201</guid><dc:creator><![CDATA[crackmaster]]></dc:creator><pubDate>Sun, 19 Aug 2007 08:24:18 GMT</pubDate></item><item><title><![CDATA[Reply to ZEIT Ausgeben on Sun, 19 Aug 2007 10:30:10 GMT]]></title><description><![CDATA[<p>wieos den szBufferTime statisch machen... die variable brauch ich doch nur ganz kurz um dort die ermittelte zeit zu speichern und dann via pointer zu übergeben, dann kann sie doch wieder freigegeben werden, oder nicht?</p>
<p>Gruß Tobi.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1347267</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1347267</guid><dc:creator><![CDATA[T0bi]]></dc:creator><pubDate>Sun, 19 Aug 2007 10:30:10 GMT</pubDate></item><item><title><![CDATA[Reply to ZEIT Ausgeben on Sun, 19 Aug 2007 11:53:19 GMT]]></title><description><![CDATA[<p>Du weißt aber das die Variable aufm Stack nicht mehr existiert, wenn du den Scope verlässt?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1347304</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1347304</guid><dc:creator><![CDATA[*D*Evil]]></dc:creator><pubDate>Sun, 19 Aug 2007 11:53:19 GMT</pubDate></item><item><title><![CDATA[Reply to ZEIT Ausgeben on Sun, 19 Aug 2007 11:56:17 GMT]]></title><description><![CDATA[<p>T0bi schrieb:</p>
<blockquote>
<p>wieos den szBufferTime statisch machen... die variable brauch ich doch nur ganz kurz um dort die ermittelte zeit zu speichern und dann via pointer zu übergeben, dann kann sie doch wieder freigegeben werden, oder nicht?</p>
<p>Gruß Tobi.</p>
</blockquote>
<p>das problem ist, dass die adresse die du dann rausbekommst auf ne stelle zeigen wird, auf der nach beendigung der funktion nichts mehr steht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1347309</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1347309</guid><dc:creator><![CDATA[[[global:former_user]]]]></dc:creator><pubDate>Sun, 19 Aug 2007 11:56:17 GMT</pubDate></item></channel></rss>