<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Simplify IUserType Testing</title>
	<atom:link href="http://randomcode.net.nz/2009/10/16/simplify-iusertype-testing/feed/" rel="self" type="application/rss+xml" />
	<link>http://randomcode.net.nz/2009/10/16/simplify-iusertype-testing/</link>
	<description>Random code and concepts from yet another .NET developer</description>
	<lastBuildDate>Mon, 20 Sep 2010 02:21:42 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Neal</title>
		<link>http://randomcode.net.nz/2009/10/16/simplify-iusertype-testing/#comment-282</link>
		<dc:creator><![CDATA[Neal]]></dc:creator>
		<pubDate>Tue, 09 Mar 2010 05:18:34 +0000</pubDate>
		<guid isPermaLink="false">http://randomcode.net.nz/?p=110#comment-282</guid>
		<description><![CDATA[Mark,
 
You can create a timezone using only an offset via the static CreateCustomTimezone method on the TimeZoneInfoClass.  the code for the factory I use is shown below.
 
&lt;code&gt;    
public static class TimeZoneInfoFactory
    {
        public static TimeZoneInfo Create( double gmtOffset )
        {
            var name = String.Format( &quot;GMT{0:+0.#;-0.#;#}&quot;, gmtOffset );
            var offsetMinutes = Convert.ToInt32( gmtOffset * 60 );
            var offset = new TimeSpan( 0, offsetMinutes, 0 );
            return TimeZoneInfo.CreateCustomTimeZone( name, offset, name, name, null, null, true );
        }
    }
&lt;/code&gt;]]></description>
		<content:encoded><![CDATA[<p>Mark,</p>
<p>You can create a timezone using only an offset via the static CreateCustomTimezone method on the TimeZoneInfoClass.  the code for the factory I use is shown below.</p>
<p><code><br />
public static class TimeZoneInfoFactory<br />
    {<br />
        public static TimeZoneInfo Create( double gmtOffset )<br />
        {<br />
            var name = String.Format( "GMT{0:+0.#;-0.#;#}", gmtOffset );<br />
            var offsetMinutes = Convert.ToInt32( gmtOffset * 60 );<br />
            var offset = new TimeSpan( 0, offsetMinutes, 0 );<br />
            return TimeZoneInfo.CreateCustomTimeZone( name, offset, name, name, null, null, true );<br />
        }<br />
    }<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark</title>
		<link>http://randomcode.net.nz/2009/10/16/simplify-iusertype-testing/#comment-281</link>
		<dc:creator><![CDATA[Mark]]></dc:creator>
		<pubDate>Thu, 04 Mar 2010 19:10:02 +0000</pubDate>
		<guid isPermaLink="false">http://randomcode.net.nz/?p=110#comment-281</guid>
		<description><![CDATA[Nice article. I especially appreciate the tests. How does TimeZoneInfoFactory work? Do you loop over TimezoneInfo.GetSystemTimeZones looking for one that matches the offset and return it? I&#039;m not sure how to initialize a TimeZoneInfo instance using only an offset. Cheers, Mark.]]></description>
		<content:encoded><![CDATA[<p>Nice article. I especially appreciate the tests. How does TimeZoneInfoFactory work? Do you loop over TimezoneInfo.GetSystemTimeZones looking for one that matches the offset and return it? I&#8217;m not sure how to initialize a TimeZoneInfo instance using only an offset. Cheers, Mark.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Neal</title>
		<link>http://randomcode.net.nz/2009/10/16/simplify-iusertype-testing/#comment-211</link>
		<dc:creator><![CDATA[Neal]]></dc:creator>
		<pubDate>Mon, 02 Nov 2009 06:34:42 +0000</pubDate>
		<guid isPermaLink="false">http://randomcode.net.nz/?p=110#comment-211</guid>
		<description><![CDATA[The reason that I only capture the offset is that this is all that is required to allow me to display the date and time to the user in their local time.  Using an NHibernate interceptor I can ensure that all times are saved to the database using UTC time and when I need to display a time in the UI, I can grab the current users timezone and, using methods provided by the TimezoneInfo class, convert UTC time to the users local time.]]></description>
		<content:encoded><![CDATA[<p>The reason that I only capture the offset is that this is all that is required to allow me to display the date and time to the user in their local time.  Using an NHibernate interceptor I can ensure that all times are saved to the database using UTC time and when I need to display a time in the UI, I can grab the current users timezone and, using methods provided by the TimezoneInfo class, convert UTC time to the users local time.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joe</title>
		<link>http://randomcode.net.nz/2009/10/16/simplify-iusertype-testing/#comment-210</link>
		<dc:creator><![CDATA[Joe]]></dc:creator>
		<pubDate>Fri, 30 Oct 2009 18:25:18 +0000</pubDate>
		<guid isPermaLink="false">http://randomcode.net.nz/?p=110#comment-210</guid>
		<description><![CDATA[Great article. I&#039;m developing an events site where timezone handling is central.

One question i have about your code is whether the offset alone is sufficient to determine a specific timezone (especially considering DST)? based on your code it seems that the name is not important, so that partially answers the question.]]></description>
		<content:encoded><![CDATA[<p>Great article. I&#8217;m developing an events site where timezone handling is central.</p>
<p>One question i have about your code is whether the offset alone is sufficient to determine a specific timezone (especially considering DST)? based on your code it seems that the name is not important, so that partially answers the question.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

