<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Timeago for C#</title>
	<atom:link href="http://www.robfe.com/2009/09/timeago-for-csharp/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.robfe.com/2009/09/timeago-for-csharp/</link>
	<description>A blog about coding by Rob Fonseca-Ensor</description>
	<lastBuildDate>Sat, 28 Jan 2012 15:51:42 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Richard O'Donnell</title>
		<link>http://www.robfe.com/2009/09/timeago-for-csharp/comment-page-1/#comment-222</link>
		<dc:creator>Richard O'Donnell</dc:creator>
		<pubDate>Tue, 20 Apr 2010 11:02:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.robfe.com/?p=157#comment-222</guid>
		<description>Rob,

Nope- I just thought the SO link would be useful for you, I didn&#039;t realise you&#039;d already seen it!

Oh well, it might be useful for someone finding your site via Google and wanting to look at other solutions to the problem.</description>
		<content:encoded><![CDATA[<p>Rob,</p>
<p>Nope- I just thought the SO link would be useful for you, I didn&#8217;t realise you&#8217;d already seen it!</p>
<p>Oh well, it might be useful for someone finding your site via Google and wanting to look at other solutions to the problem.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rob</title>
		<link>http://www.robfe.com/2009/09/timeago-for-csharp/comment-page-1/#comment-221</link>
		<dc:creator>Rob</dc:creator>
		<pubDate>Tue, 20 Apr 2010 10:57:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.robfe.com/?p=157#comment-221</guid>
		<description>Hey thanks Richard - did you see my comment at http://stackoverflow.com/questions/11/how-do-i-calculate-relative-time/111303#111303</description>
		<content:encoded><![CDATA[<p>Hey thanks Richard &#8211; did you see my comment at <a href="http://stackoverflow.com/questions/11/how-do-i-calculate-relative-time/111303#111303" rel="nofollow">http://stackoverflow.com/questions/11/how-do-i-calculate-relative-time/111303#111303</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Richard O'Donnell</title>
		<link>http://www.robfe.com/2009/09/timeago-for-csharp/comment-page-1/#comment-220</link>
		<dc:creator>Richard O'Donnell</dc:creator>
		<pubDate>Tue, 20 Apr 2010 10:43:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.robfe.com/?p=157#comment-220</guid>
		<description>Have a look at this: http://stackoverflow.com/questions/11/how-do-i-calculate-relative-time</description>
		<content:encoded><![CDATA[<p>Have a look at this: <a href="http://stackoverflow.com/questions/11/how-do-i-calculate-relative-time" rel="nofollow">http://stackoverflow.com/questions/11/how-do-i-calculate-relative-time</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Luke Venediger</title>
		<link>http://www.robfe.com/2009/09/timeago-for-csharp/comment-page-1/#comment-216</link>
		<dc:creator>Luke Venediger</dc:creator>
		<pubDate>Thu, 18 Feb 2010 12:58:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.robfe.com/?p=157#comment-216</guid>
		<description>Hi, thanks for this! I&#039;ve modified it to be an extension method off TimeSpan:


&lt;code&gt;    public static string PrettyPrint(this TimeSpan t)
    {
      string[] NAMES = {
                                         &quot;day&quot;,
                                         &quot;hour&quot;,
                                         &quot;minute&quot;,
                                         &quot;second&quot;
                                     };

      int[] ints = {
                         t.Days,
                         t.Hours,
                         t.Minutes,
                         t.Seconds
                     };

      double[] doubles = {
                               t.TotalDays,
                               t.TotalHours,
                               t.TotalMinutes,
                               t.TotalSeconds
                           };

      var firstNonZero = ints
          .Select((value, index) =&gt; new { value, index })
          .FirstOrDefault(x =&gt; x.value != 0);
      if (firstNonZero == null)
      {
        return &quot;now&quot;;
      }
      int i = firstNonZero.index;
      string prefix = (i &gt;= 3) ? &quot;&quot; : &quot;about &quot;;
      int quantity = (int)Math.Round(doubles[i]);

      Func Tense = (q, n) =&gt; q == 1
                                    ? &quot;1 &quot; + n
                                    : string.Format(&quot;{0} {1}s&quot;, q, n);

      return prefix + Tense(quantity, NAMES[i]);
    }&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Hi, thanks for this! I&#8217;ve modified it to be an extension method off TimeSpan:</p>
<p><code>    public static string PrettyPrint(this TimeSpan t)<br />
    {<br />
      string[] NAMES = {<br />
                                         "day",<br />
                                         "hour",<br />
                                         "minute",<br />
                                         "second"<br />
                                     };</p>
<p>      int[] ints = {<br />
                         t.Days,<br />
                         t.Hours,<br />
                         t.Minutes,<br />
                         t.Seconds<br />
                     };</p>
<p>      double[] doubles = {<br />
                               t.TotalDays,<br />
                               t.TotalHours,<br />
                               t.TotalMinutes,<br />
                               t.TotalSeconds<br />
                           };</p>
<p>      var firstNonZero = ints<br />
          .Select((value, index) =&gt; new { value, index })<br />
          .FirstOrDefault(x =&gt; x.value != 0);<br />
      if (firstNonZero == null)<br />
      {<br />
        return "now";<br />
      }<br />
      int i = firstNonZero.index;<br />
      string prefix = (i &gt;= 3) ? "" : "about ";<br />
      int quantity = (int)Math.Round(doubles[i]);</p>
<p>      Func Tense = (q, n) =&gt; q == 1<br />
                                    ? "1 " + n<br />
                                    : string.Format("{0} {1}s", q, n);</p>
<p>      return prefix + Tense(quantity, NAMES[i]);<br />
    }</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: IanR</title>
		<link>http://www.robfe.com/2009/09/timeago-for-csharp/comment-page-1/#comment-169</link>
		<dc:creator>IanR</dc:creator>
		<pubDate>Thu, 10 Sep 2009 08:00:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.robfe.com/?p=157#comment-169</guid>
		<description>Nice!
I did something similar a while ago, but without the elegance of this solution, obviously :)</description>
		<content:encoded><![CDATA[<p>Nice!<br />
I did something similar a while ago, but without the elegance of this solution, obviously <img src='http://www.robfe.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>

