<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>DateTime.UtcNow is generally preferable to DateTime.Now</title><link>http://blogs.msdn.com/b/kirillosenkov/archive/2012/01/10/datetime-utcnow-is-generally-preferable-to-datetime-now.aspx</link><description>This seems to be commonly known and accepted best practice to use DateTime.UtcNow for non-user facing scenarios such as time interval and timeout measurement. I’ve just done an audit of the Roslyn codebase and replaced most DateTime.Now calls with DateTime</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: DateTime.UtcNow is generally preferable to DateTime.Now</title><link>http://blogs.msdn.com/b/kirillosenkov/archive/2012/01/10/datetime-utcnow-is-generally-preferable-to-datetime-now.aspx#10255823</link><pubDate>Thu, 12 Jan 2012 06:04:38 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10255823</guid><dc:creator>Kirill Osenkov - MSFT</dc:creator><description>&lt;p&gt;Sk - sorry about that - follow the link to Keyvan&amp;#39;s article, he has detailed explanations and the benchmark source code.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10255823" width="1" height="1"&gt;</description></item><item><title>re: DateTime.UtcNow is generally preferable to DateTime.Now</title><link>http://blogs.msdn.com/b/kirillosenkov/archive/2012/01/10/datetime-utcnow-is-generally-preferable-to-datetime-now.aspx#10255774</link><pubDate>Thu, 12 Jan 2012 01:47:34 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10255774</guid><dc:creator>Sk</dc:creator><description>&lt;p&gt;@Kirill Could you add the labels for the xy-axis on the chart. I am not sure what we are comparing. I just see numbers only which is not that informative. Thanks.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10255774" width="1" height="1"&gt;</description></item><item><title>re: DateTime.UtcNow is generally preferable to DateTime.Now</title><link>http://blogs.msdn.com/b/kirillosenkov/archive/2012/01/10/datetime-utcnow-is-generally-preferable-to-datetime-now.aspx#10255761</link><pubDate>Thu, 12 Jan 2012 00:58:34 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10255761</guid><dc:creator>Kirill Osenkov - MSFT</dc:creator><description>&lt;p&gt;James - also thanks for the DateTimeOffset tip :)&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10255761" width="1" height="1"&gt;</description></item><item><title>re: DateTime.UtcNow is generally preferable to DateTime.Now</title><link>http://blogs.msdn.com/b/kirillosenkov/archive/2012/01/10/datetime-utcnow-is-generally-preferable-to-datetime-now.aspx#10255760</link><pubDate>Thu, 12 Jan 2012 00:57:51 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10255760</guid><dc:creator>Kirill Osenkov - MSFT</dc:creator><description>&lt;p&gt;Oleg - we just use it as a random number generator when we need a random looking version :)&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10255760" width="1" height="1"&gt;</description></item><item><title>re: DateTime.UtcNow is generally preferable to DateTime.Now</title><link>http://blogs.msdn.com/b/kirillosenkov/archive/2012/01/10/datetime-utcnow-is-generally-preferable-to-datetime-now.aspx#10255757</link><pubDate>Thu, 12 Jan 2012 00:57:07 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10255757</guid><dc:creator>Kirill Osenkov - MSFT</dc:creator><description>&lt;p&gt;Folks, I just noticed that Keyvan&amp;#39;s benchmark counts allocations of the Stopwatch object. If he reuses the same Stopwatch instance, the perf will be much much better than shown on his graph. I&amp;#39;ve posted my own graph in the post above without allocations for Stopwatch.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10255757" width="1" height="1"&gt;</description></item><item><title>re: DateTime.UtcNow is generally preferable to DateTime.Now</title><link>http://blogs.msdn.com/b/kirillosenkov/archive/2012/01/10/datetime-utcnow-is-generally-preferable-to-datetime-now.aspx#10255507</link><pubDate>Wed, 11 Jan 2012 12:48:56 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10255507</guid><dc:creator>Damian Hickey</dc:creator><description>&lt;p&gt;Consider not using DateTime.UtcNow either but a &amp;#39;SystemTime&amp;#39; abstraction. Reading DateTime.UtcNow can also be significantly optimized.&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://dhickey.ie/post/2011/09/01/SystemClock.aspx"&gt;dhickey.ie/.../SystemClock.aspx&lt;/a&gt;&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10255507" width="1" height="1"&gt;</description></item><item><title>re: DateTime.UtcNow is generally preferable to DateTime.Now</title><link>http://blogs.msdn.com/b/kirillosenkov/archive/2012/01/10/datetime-utcnow-is-generally-preferable-to-datetime-now.aspx#10255453</link><pubDate>Wed, 11 Jan 2012 09:29:49 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10255453</guid><dc:creator>Oleg Mihailik</dc:creator><description>&lt;p&gt;Why would you use localized time for Version generation?&lt;/p&gt;
&lt;p&gt;In global companies with projects developed from multiple time zones it is likely to ruin the ordering. Consider this very real and likely situation:&lt;/p&gt;
&lt;p&gt;I build and release an app from New Jersey. Version generated from wall clock is 1.234.&lt;/p&gt;
&lt;p&gt;The app has a bug which is picked by my colleague from Bangalore.&lt;/p&gt;
&lt;p&gt;In 15 minutes she fixes, tests and releases a new patched version, which is 1.155.&lt;/p&gt;
&lt;p&gt;It is late night in Jersey City, but early morning in Bangalore. So my version is larger than hers. Imagine how misleading it will be to debug any problem in this situation.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10255453" width="1" height="1"&gt;</description></item><item><title>re: DateTime.UtcNow is generally preferable to DateTime.Now</title><link>http://blogs.msdn.com/b/kirillosenkov/archive/2012/01/10/datetime-utcnow-is-generally-preferable-to-datetime-now.aspx#10255379</link><pubDate>Wed, 11 Jan 2012 05:13:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10255379</guid><dc:creator>James Manning</dc:creator><description>&lt;p&gt;IMHO using DateTimeOffset (datetimeoffset type in SQL Server) is better for many applications since you &amp;#39;free&amp;#39; yourself from having to worry about converting to or from UTC - when it comes time to display it to the user, you can have it display in their timezone regardless of what it started out as.&lt;/p&gt;
&lt;p&gt;*So* many headaches/bugs come up from people forgetting to &amp;#39;normalize&amp;#39; onto UTC, that it really doesn&amp;#39;t seem worth using &amp;#39;just&amp;#39; DateTime in the vast majority of cases.&lt;/p&gt;
&lt;p&gt;And there&amp;#39;s still DateTimeOffset.UtcNow to use for that case, which should be very fast since it&amp;#39;s DateTime.UtcNow with TimeSpan.Zero :)&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10255379" width="1" height="1"&gt;</description></item><item><title>re: DateTime.UtcNow is generally preferable to DateTime.Now</title><link>http://blogs.msdn.com/b/kirillosenkov/archive/2012/01/10/datetime-utcnow-is-generally-preferable-to-datetime-now.aspx#10255275</link><pubDate>Tue, 10 Jan 2012 20:41:45 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10255275</guid><dc:creator>Diego F.</dc:creator><description>&lt;p&gt;Great tip, never thought about it, even while seeing performance reports pointing to DateTime.Now costs. The small things that make difference. I didn&amp;#39;t know I had a cheap alternative.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10255275" width="1" height="1"&gt;</description></item></channel></rss>