Chen Writes C#: Film at 23:00:00
When Raymond Chen writes something in his blog in C#, I pay attention.
His gift is for finding the most braindead, simple, "how can you possibly get this wrong?" algorithms and then show incontrovertibly that things are much more complicated than they would appear to the academic observer. Today's selection is on finding the length of time between two points, and how it's not as simple as taking for granted that January 1 2004 and January 1 2005 are 1 year apart. My only complaint is that I haven't found an elegant way to fold the TotalSeconds property in the .NET TimeSpan class into bigger units of time. Using TotalSeconds avoids the problem Raymond's mentioned about people born on February 29 having a birthday once every four years. I may post a little bit of code clarifying this issue, if given time and effort.
No comments:
Post a Comment