<?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[SYSTEMTIME: hinzufügen von Sekunden]]></title><description><![CDATA[<p>Hi @ All.</p>
<p>ich habe eine SystemTime-Struktur.<br />
die hat den altuellen zeitpunkt von LocalTime.</p>
<p>nun habe ich eine Variable dwCount.<br />
Die enthält den Countdown, das heißt, wiviele Sekunden zur SYSTEMTIME zugezählt werden müssen.</p>
<p>Das heißt wSeconds += dwCount.</p>
<p>der CountDown kann aber auch über stunden,monate... hinweg gehen.</p>
<p>also wie mache ich dass wenn wSeconds 60 hat??</p>
<p>und was mache ich mit den Monaten, die ja immer unterschiedlich lang sind???</p>
<p>meine jetzige anlaufstelle:</p>
<pre><code class="language-cpp">void CAlarmClock::SetRelative(DWORD dwCount)
{
	// vordefiniert: SYSTEMTIME stAlarm;
	GetLocalTime(&amp;stAlarm);

	while (dwCount &gt;= 3600*24*365) // A year
	{
		stAlarm.wYear++;
		dwCount -= 3600*24*365;
	}
	while (dwCount &gt;= 3600*24*365) // A month
	{
		// k.A.
		stAlarm.wYear++;
		dwCount -= 3600*24*365;
	}
	...
}
</code></pre>
<p>Danke.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/191261/systemtime-hinzufügen-von-sekunden</link><generator>RSS for Node</generator><lastBuildDate>Wed, 01 Jul 2026 12:28:50 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/191261.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 31 Aug 2007 19:20:06 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to SYSTEMTIME: hinzufügen von Sekunden on Fri, 31 Aug 2007 19:20:06 GMT]]></title><description><![CDATA[<p>Hi @ All.</p>
<p>ich habe eine SystemTime-Struktur.<br />
die hat den altuellen zeitpunkt von LocalTime.</p>
<p>nun habe ich eine Variable dwCount.<br />
Die enthält den Countdown, das heißt, wiviele Sekunden zur SYSTEMTIME zugezählt werden müssen.</p>
<p>Das heißt wSeconds += dwCount.</p>
<p>der CountDown kann aber auch über stunden,monate... hinweg gehen.</p>
<p>also wie mache ich dass wenn wSeconds 60 hat??</p>
<p>und was mache ich mit den Monaten, die ja immer unterschiedlich lang sind???</p>
<p>meine jetzige anlaufstelle:</p>
<pre><code class="language-cpp">void CAlarmClock::SetRelative(DWORD dwCount)
{
	// vordefiniert: SYSTEMTIME stAlarm;
	GetLocalTime(&amp;stAlarm);

	while (dwCount &gt;= 3600*24*365) // A year
	{
		stAlarm.wYear++;
		dwCount -= 3600*24*365;
	}
	while (dwCount &gt;= 3600*24*365) // A month
	{
		// k.A.
		stAlarm.wYear++;
		dwCount -= 3600*24*365;
	}
	...
}
</code></pre>
<p>Danke.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1356401</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1356401</guid><dc:creator><![CDATA[Script-Styler]]></dc:creator><pubDate>Fri, 31 Aug 2007 19:20:06 GMT</pubDate></item><item><title><![CDATA[Reply to SYSTEMTIME: hinzufügen von Sekunden on Fri, 31 Aug 2007 19:25:57 GMT]]></title><description><![CDATA[<p>Wandle die SYSTEMTIME nach FILETIME um und führe dann die Addition durch. Wandle dann wieder zurück. (Siehe: FileTimeToSystemTime und SystemTimeToFileTime)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1356408</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1356408</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Fri, 31 Aug 2007 19:25:57 GMT</pubDate></item><item><title><![CDATA[Reply to SYSTEMTIME: hinzufügen von Sekunden on Fri, 31 Aug 2007 19:38:09 GMT]]></title><description><![CDATA[<blockquote>
<p>It is not recommended that you add and subtract values from the FILETIME structure to obtain relative times. Instead, you should copy the low- and high-order parts of the file time to a LARGE_INTEGER structure, perform 64-bit arithmetic on the QuadPart member, and copy the LowPart and HighPart members into the FILETIME structure.</p>
<p>Do not cast a pointer to a FILETIME structure to either a LARGE_INTEGER* or __int64* value because it can cause alignment faults on 64-bit Windows.</p>
</blockquote>
<p>Was heißt dass, und wie kann ich das zuzählen???</p>
<p>das habe ich:</p>
<pre><code class="language-cpp">FILETIME ftAlarm;
	GetLocalTime(&amp;stAlarm);
	SystemTimeToFileTime(&amp;stAlarm,&amp;ftAlarm);

	// Hinzufügen, aber wie?

	FileTimeToSystemTime(&amp;ftAlarm,&amp;stAlarm);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1356420</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1356420</guid><dc:creator><![CDATA[Script-Styler]]></dc:creator><pubDate>Fri, 31 Aug 2007 19:38:09 GMT</pubDate></item><item><title><![CDATA[Reply to SYSTEMTIME: hinzufügen von Sekunden on Fri, 31 Aug 2007 20:36:18 GMT]]></title><description><![CDATA[<p>leute!</p>
<p>was hat es mit diesem Low und high part auf sich???</p>
<p>thx.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1356464</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1356464</guid><dc:creator><![CDATA[Script-Styler]]></dc:creator><pubDate>Fri, 31 Aug 2007 20:36:18 GMT</pubDate></item><item><title><![CDATA[Reply to SYSTEMTIME: hinzufügen von Sekunden on Fri, 31 Aug 2007 20:43:14 GMT]]></title><description><![CDATA[<p>Ignoriert FILETIME denn Leap-Seconds etc.?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1356474</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1356474</guid><dc:creator><![CDATA[hustbaer]]></dc:creator><pubDate>Fri, 31 Aug 2007 20:43:14 GMT</pubDate></item><item><title><![CDATA[Reply to SYSTEMTIME: hinzufügen von Sekunden on Fri, 31 Aug 2007 20:44:37 GMT]]></title><description><![CDATA[<p>hustbaer schrieb:</p>
<blockquote>
<p>Ignoriert FILETIME denn Leap-Seconds etc.?</p>
</blockquote>
<p>Was sind denn Leap-Seconds???</p>
<p>und wie soll ich die Zeit dazuzählen???</p>
<p>Danke. brauch dringend hilfe.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1356476</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1356476</guid><dc:creator><![CDATA[Script-Styler]]></dc:creator><pubDate>Fri, 31 Aug 2007 20:44:37 GMT</pubDate></item><item><title><![CDATA[Reply to SYSTEMTIME: hinzufügen von Sekunden on Fri, 31 Aug 2007 21:01:19 GMT]]></title><description><![CDATA[<p>Was sind Leap-Seconds? Lead Seconds sind LÄSTIG:<br />
<a href="http://en.wikipedia.org/wiki/Leap_second" rel="nofollow">http://en.wikipedia.org/wiki/Leap_second</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1356493</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1356493</guid><dc:creator><![CDATA[hustbaer]]></dc:creator><pubDate>Fri, 31 Aug 2007 21:01:19 GMT</pubDate></item><item><title><![CDATA[Reply to SYSTEMTIME: hinzufügen von Sekunden on Fri, 31 Aug 2007 22:18:48 GMT]]></title><description><![CDATA[<p>Naja, ok.</p>
<p>aber ich möchte!! mur wissen, wie ich zu einer FILETIME struktur einen in DWORD variable gespeicherten wert addieren kann.</p>
<p>weil da ist so ein Low und High part.</p>
<p>was ist dass? wie kann ich damit rechnen??</p>
<p>danke.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1356535</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1356535</guid><dc:creator><![CDATA[Script-Styler]]></dc:creator><pubDate>Fri, 31 Aug 2007 22:18:48 GMT</pubDate></item><item><title><![CDATA[Reply to SYSTEMTIME: hinzufügen von Sekunden on Fri, 31 Aug 2007 22:42:37 GMT]]></title><description><![CDATA[<p>bis jetzt habe ich dass: aber er fügt mir immer nur im 8-minutentakt hinzu.</p>
<pre><code class="language-cpp">FILETIME ftAlarm;
	GetLocalTime(&amp;stAlarm);
	SystemTimeToFileTime(&amp;stAlarm,&amp;ftAlarm);

	// Increment file time
	ftAlarm.dwHighDateTime += dwCount;

	FileTimeToSystemTime(&amp;ftAlarm,&amp;stAlarm);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1356542</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1356542</guid><dc:creator><![CDATA[Script-Styler]]></dc:creator><pubDate>Fri, 31 Aug 2007 22:42:37 GMT</pubDate></item><item><title><![CDATA[Reply to SYSTEMTIME: hinzufügen von Sekunden on Sat, 01 Sep 2007 08:18:16 GMT]]></title><description><![CDATA[<p>naja, das einfachste ist, du kopierst die FILETIME in einen __int64 und zählst dann die Zahl dazu; kopierst es wieder zurück in die FILETIME und konvertierst es wieder in die SYSTEMTIME... muss die Funktion bei mir mal suchen, die das macht...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1356611</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1356611</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Sat, 01 Sep 2007 08:18:16 GMT</pubDate></item><item><title><![CDATA[Reply to SYSTEMTIME: hinzufügen von Sekunden on Sat, 01 Sep 2007 08:48:07 GMT]]></title><description><![CDATA[<p>aber, wenn man beide (low + high part) in einen __int64 kopiert,</p>
<p>woher will man wissen, wenn man beide zurückkopiert, was in den low und was in den high part muss???</p>
<p>danke.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1356624</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1356624</guid><dc:creator><![CDATA[Script-Styler]]></dc:creator><pubDate>Sat, 01 Sep 2007 08:48:07 GMT</pubDate></item><item><title><![CDATA[Reply to SYSTEMTIME: hinzufügen von Sekunden on Sat, 01 Sep 2007 08:58:40 GMT]]></title><description><![CDATA[<p>Lies doch bitte die Doku zu FILETIME... da steht es drin... es spielt keine Rolle, was in Low/HighPart drin steht... wichtig ist nur, dass der 64-Bit-Wert eine Zeitangabe seit 1601 in 100 ns ist..</p>
<p>Ungestest:</p>
<pre><code class="language-cpp">void AddSec(SYSTEMTIME &amp;st, int sekundenToAdd)
{
  ULONGLONG ull;
  FILETIME ft;
  SystemTimeToFileTime(&amp;st, &amp;ft);
  memcpy(&amp;ull, &amp;ft, min(sizeof(ULONGLONG), sizeof(FILETIME)));

  ULONLONG ulSecAdd = (ULONGLONG)10000000*(ULONGLONG)sekundenToAdd;
  ull += ulSecAdd;
  memcpy(&amp;ft, &amp;ull, min(sizeof(ULONGLONG), sizeof(FILETIME)));
  FileTimeToSystemTime(&amp;ft, &amp;st);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1356630</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1356630</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Sat, 01 Sep 2007 08:58:40 GMT</pubDate></item><item><title><![CDATA[Reply to SYSTEMTIME: hinzufügen von Sekunden on Sat, 01 Sep 2007 09:57:32 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">// Microsoft empfiehlt es so zu machen (warum auch immer, schätze mal wegen endianness):
void AddToFiletime(FILETIME&amp; ft, DWORD x)
{
	LARGE_INTEGER li;
	li.HighPart = ft.dwHighDateTime;
	li.LowPart = ft.dwLowDateTime;
	li.QuadPart += x;
	ft.dwHighDateTime = li.HighPart;
	ft.dwLowDateTime = li.LowPart;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1356667</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1356667</guid><dc:creator><![CDATA[hustbaer]]></dc:creator><pubDate>Sat, 01 Sep 2007 09:57:32 GMT</pubDate></item></channel></rss>