<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" media="screen" href="/styles/xslt/rss.xslt"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:c9="http://channel9.msdn.com">
<channel>
	<title>Channel 9 Forums - Coffeehouse - Multiple Alaram Clock</title>
	<atom:link rel="self" type="application/rss+xml" href="http://channel9.msdn.com/Forums/rss"></atom:link>
	<image>
		<url>http://mschnlnine.vo.llnwd.net/d1/Dev/App_Themes/C9/images/feedimage.png</url>
		<title>Channel 9 Forums - Coffeehouse - Multiple Alaram Clock</title>
		<link>http://channel9.msdn.com/Forums</link>
	</image>
	<description>Channel 9 keeps you up to date with the latest news and behind the scenes info from Microsoft that developers love to keep up with. From LINQ to SilverLight – Watch videos and hear about all the cool technologies coming and the people behind them.</description>
	<link>http://channel9.msdn.com/Forums</link>
	<language>en</language>
	<pubDate>Fri, 24 May 2013 23:56:16 GMT</pubDate>
	<lastBuildDate>Fri, 24 May 2013 23:56:16 GMT</lastBuildDate>
	<generator>Rev9</generator>
	<c9:totalResults>11</c9:totalResults>
	<c9:pageCount>-11</c9:pageCount>
	<c9:pageSize>-1</c9:pageSize>
	<item>
		<title>Coffeehouse - Multiple Alaram Clock</title>
		<description><![CDATA[<p>Hi Can Anyone tell me how i can develop alarm clock in c# with multiple alarms. plzzz reply soon&nbsp;</p>]]></description>
		<link>http://channel9.msdn.com/Forums/Coffeehouse/Multiple-Alaram-Clock/2420dbc9841846f3a386a02a012036b5#2420dbc9841846f3a386a02a012036b5</link>
		<pubDate>Thu, 05 Apr 2012 17:29:21 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/Coffeehouse/Multiple-Alaram-Clock/2420dbc9841846f3a386a02a012036b5#2420dbc9841846f3a386a02a012036b5</guid>
		<dc:creator>enigma34</dc:creator>
		<slash:comments>11</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/enigma34/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Coffeehouse - Multiple Alaram Clock</title>
		<description><![CDATA[<p>Explain your problem in detail please.</p>]]></description>
		<link>http://channel9.msdn.com/Forums/Coffeehouse/Multiple-Alaram-Clock/b5caade79ce64d5db6cca02a01525c41#b5caade79ce64d5db6cca02a01525c41</link>
		<pubDate>Thu, 05 Apr 2012 20:31:55 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/Coffeehouse/Multiple-Alaram-Clock/b5caade79ce64d5db6cca02a01525c41#b5caade79ce64d5db6cca02a01525c41</guid>
		<dc:creator>ZippyV</dc:creator>
		<slash:comments>11</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/ZippyV/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Coffeehouse - Multiple Alaram Clock</title>
		<description><![CDATA[<p>@<a href="/Forums/Coffeehouse/Multiple-Alaram-Clock#cb5caade79ce64d5db6cca02a01525c41">ZippyV</a>: Lemme see if I can explain for the OP.</p><p>You see I'm a student that has an assignment due and rather than do the research I'd like you to do it for me -- for free. The assignment is due soon so I'd appreciate it if you tell me what to do really soon.</p>]]></description>
		<link>http://channel9.msdn.com/Forums/Coffeehouse/Multiple-Alaram-Clock/7ef776436a514d748bd6a02a015e9af4#7ef776436a514d748bd6a02a015e9af4</link>
		<pubDate>Thu, 05 Apr 2012 21:16:30 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/Coffeehouse/Multiple-Alaram-Clock/7ef776436a514d748bd6a02a015e9af4#7ef776436a514d748bd6a02a015e9af4</guid>
		<dc:creator>DeathByVisualStudio</dc:creator>
		<slash:comments>11</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/DeathByVisualStudio/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Coffeehouse - Multiple Alaram Clock</title>
		<description><![CDATA[<p>@<a href="/Forums/Coffeehouse/Multiple-Alaram-Clock#c7ef776436a514d748bd6a02a015e9af4">DeathByVisualStudio</a>: Yeah, I thought when I read the question I wish sometimes it was that simple to just ask someone else to do your work for you.</p><p>&nbsp;I can see it now.</p><p>Your manager comes in and says were are we on that new invoicing module.<br>You say:&nbsp;I am waiting for somebody on channel nine to give me the code to paste into visual studio.</p>]]></description>
		<link>http://channel9.msdn.com/Forums/Coffeehouse/Multiple-Alaram-Clock/574d94aeebd240c19cf3a02a0160b0f3#574d94aeebd240c19cf3a02a0160b0f3</link>
		<pubDate>Thu, 05 Apr 2012 21:24:06 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/Coffeehouse/Multiple-Alaram-Clock/574d94aeebd240c19cf3a02a0160b0f3#574d94aeebd240c19cf3a02a0160b0f3</guid>
		<dc:creator>Darin Clark</dc:creator>
		<slash:comments>11</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/devSpeed/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Coffeehouse - Multiple Alaram Clock</title>
		<description><![CDATA[<p>@<a href="/Forums/Coffeehouse/Multiple-Alaram-Clock#c7ef776436a514d748bd6a02a015e9af4">DeathByVisualStudio</a>: I'm trying to get him to explain his problem and divide a big problem into multiple smaller problems until every problem is small enough to be solved in a couple of lines of code.</p>]]></description>
		<link>http://channel9.msdn.com/Forums/Coffeehouse/Multiple-Alaram-Clock/fd21bee511f84be59583a02a01681ebb#fd21bee511f84be59583a02a01681ebb</link>
		<pubDate>Thu, 05 Apr 2012 21:51:09 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/Coffeehouse/Multiple-Alaram-Clock/fd21bee511f84be59583a02a01681ebb#fd21bee511f84be59583a02a01681ebb</guid>
		<dc:creator>ZippyV</dc:creator>
		<slash:comments>11</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/ZippyV/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Coffeehouse - Multiple Alaram Clock</title>
		<description><![CDATA[<p>@<a href="/Forums/Coffeehouse/Multiple-Alaram-Clock#cfd21bee511f84be59583a02a01681ebb">ZippyV</a>: But what if his statement is the small problem? <img src='http://ecn.channel9.msdn.com/o9/content/images/emoticons/emotion-1.gif?v=c9' alt='Smiley' /></p>]]></description>
		<link>http://channel9.msdn.com/Forums/Coffeehouse/Multiple-Alaram-Clock/1952130a056f40649b31a02a01691c2a#1952130a056f40649b31a02a01691c2a</link>
		<pubDate>Thu, 05 Apr 2012 21:54:45 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/Coffeehouse/Multiple-Alaram-Clock/1952130a056f40649b31a02a01691c2a#1952130a056f40649b31a02a01691c2a</guid>
		<dc:creator>DeathByVisualStudio</dc:creator>
		<slash:comments>11</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/DeathByVisualStudio/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Coffeehouse - Multiple Alaram Clock</title>
		<description><![CDATA[<p>For him it's not.</p>]]></description>
		<link>http://channel9.msdn.com/Forums/Coffeehouse/Multiple-Alaram-Clock/5c620f260f734c53ac52a02a0169be5a#5c620f260f734c53ac52a02a0169be5a</link>
		<pubDate>Thu, 05 Apr 2012 21:57:04 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/Coffeehouse/Multiple-Alaram-Clock/5c620f260f734c53ac52a02a0169be5a#5c620f260f734c53ac52a02a0169be5a</guid>
		<dc:creator>ZippyV</dc:creator>
		<slash:comments>11</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/ZippyV/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Coffeehouse - Multiple Alaram Clock</title>
		<description><![CDATA[<p>@<a href="/Forums/Coffeehouse/Multiple-Alaram-Clock#c5c620f260f734c53ac52a02a0169be5a">ZippyV</a>: And that's the part he's missing.</p>]]></description>
		<link>http://channel9.msdn.com/Forums/Coffeehouse/Multiple-Alaram-Clock/91ab4e1d679441438e00a02a017220a4#91ab4e1d679441438e00a02a017220a4</link>
		<pubDate>Thu, 05 Apr 2012 22:27:35 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/Coffeehouse/Multiple-Alaram-Clock/91ab4e1d679441438e00a02a017220a4#91ab4e1d679441438e00a02a017220a4</guid>
		<dc:creator>DeathByVisualStudio</dc:creator>
		<slash:comments>11</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/DeathByVisualStudio/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Coffeehouse - Multiple Alaram Clock</title>
		<description><![CDATA[<p>Basic solution for multiple alarms: &nbsp;Have a single timer that fires at appropriate intervals (depending on the accuracy or your alarms that could be every second or every minute). &nbsp;When the timer fires, check a list of alarm times to see if you have reached one yet; if so show the alarm message to the user.</p><p>Simple.</p><p>Herbie</p>]]></description>
		<link>http://channel9.msdn.com/Forums/Coffeehouse/Multiple-Alaram-Clock/804a4f3899f947d2b20aa02b0063248b#804a4f3899f947d2b20aa02b0063248b</link>
		<pubDate>Fri, 06 Apr 2012 06:00:58 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/Coffeehouse/Multiple-Alaram-Clock/804a4f3899f947d2b20aa02b0063248b#804a4f3899f947d2b20aa02b0063248b</guid>
		<dc:creator>Herbie Smith</dc:creator>
		<slash:comments>11</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/Dr Herbie/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Coffeehouse - Multiple Alaram Clock</title>
		<description><![CDATA[<p><pre class="brush: csharp">  // Known Bugs: It is theoretically possible to &quot;skip&quot; an alarm if within seconds of one another    
        // TODO: One thread per alarm; sub-second accuaracy, replace TimeSpan with maths 
        static DateTime? Watcher(DateTime[] alarms)
        {
            // Find the next nearest alarm. 
            long nextAlarm = -1;
            foreach (DateTime alarm in alarms)
                if (alarm.Ticks - DateTime.Now.Ticks &gt; 0 &amp;&amp; (alarm.Ticks &lt; nextAlarm || nextAlarm == -1))
                    nextAlarm = alarm.Ticks;

            // Below checks/sleeps are &quot;optional.&quot; They just save it calling DateTime.Now every 1000 ms. 
            while (TimeSpan.FromTicks(nextAlarm - DateTime.Now.Ticks).Days &gt; 0)
                Thread.Sleep(86400000);

            while (TimeSpan.FromTicks(nextAlarm - DateTime.Now.Ticks).Hours &gt; 0)
                Thread.Sleep(3600000);

            while (TimeSpan.FromTicks(nextAlarm - DateTime.Now.Ticks).Minutes &gt; 0)
                Thread.Sleep(60000);

            // Do not remove the below. Is the actual production code within this function. 
            while (TimeSpan.FromTicks(nextAlarm - DateTime.Now.Ticks).Seconds &gt; 0)
                Thread.Sleep(1000);

            if (nextAlarm == -1)
                return null;

            Thread.Sleep(1000); // Stops re-trigging within the second. Technically might trigger after target second.  
            return new DateTime(nextAlarm); // Object reference to the original alarm would be cheaper here. 
        }

        static void Main()
        {
            DateTime[] alarms = new DateTime[] { new DateTime(2012, 04, 06, 10, 01, 30), new DateTime(2012, 04, 06, 10, 02, 30) };
            do
            {
                DateTime? trigger = Watcher(alarms); 
                if(trigger == null) // We're out of alarms, time to die
                    break;
                Console.WriteLine(trigger.ToString());
            } while (true); 
        }</pre></p>]]></description>
		<link>http://channel9.msdn.com/Forums/Coffeehouse/Multiple-Alaram-Clock/808c217ab84a4021b775a02b00979605#808c217ab84a4021b775a02b00979605</link>
		<pubDate>Fri, 06 Apr 2012 09:11:54 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/Coffeehouse/Multiple-Alaram-Clock/808c217ab84a4021b775a02b00979605#808c217ab84a4021b775a02b00979605</guid>
		<dc:creator>Manip</dc:creator>
		<slash:comments>11</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/ManipUni/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Coffeehouse - Multiple Alaram Clock</title>
		<description><![CDATA[<p></p><blockquote><div class="quoteText"><p></p><p><a class="permalink" title="Post Permalink" href="/Forums/Coffeehouse/Multiple-Alaram-Clock/804a4f3899f947d2b20aa02b0063248b">3 hours&nbsp;ago</a>, <a href="/Niners/Dr%20Herbie">Dr&nbsp;Herbie</a> wrote</p><p>Basic solution for multiple alarms: &nbsp;Have a single timer that fires at appropriate intervals (depending on the accuracy or your alarms that could be every second or every minute). &nbsp;When the timer fires, check a list of alarm times to see if you have reached one yet; if so show the alarm message to the user.</p><p>Simple.</p><p>Herbie</p><p></p></div></blockquote><p></p><p>My basic solution would be to use the <a href="http://quartz-scheduler.org/">quartz scheduler</a>. Written well (the .NET port), tried and tested so relatively bug free. </p><p>&nbsp;</p>]]></description>
		<link>http://channel9.msdn.com/Forums/Coffeehouse/Multiple-Alaram-Clock/c6fe427bb7fb48bd95c7a02b00a34be1#c6fe427bb7fb48bd95c7a02b00a34be1</link>
		<pubDate>Fri, 06 Apr 2012 09:54:32 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/Coffeehouse/Multiple-Alaram-Clock/c6fe427bb7fb48bd95c7a02b00a34be1#c6fe427bb7fb48bd95c7a02b00a34be1</guid>
		<dc:creator>Vesuvius</dc:creator>
		<slash:comments>11</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/vesuvius/Discussions/RSS</wfw:commentRss>
	</item>
</channel>
</rss>