stuff i do at work

(maybe i’ll make less mistakes if i remember some)

datetime.utcnow 40x faster than datetime.now

Posted by noah on May 21, 2008

DateTime.UtcNow is over 40x faster than DateTime.Now in c#.

DateTime.UtcNow.AddHours(-5) is 20x faster than DateTime.Now.  this doesn’t work in practice because you have to account for daylight savings time… and there’s no fast built-in way to do it

so if perf is critical, avoid using local time

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>