Killian Brendel was reading the .NET reference source and stumbled across the comment block on the TimeSpan struct. It starts out sensibly: a TimeSpan is a duration, it can be negative or positive, and internally it is a number of milliseconds. The comment then explains why the struct offers no Years() or Months() methods: months vary between 28 and 31 days, so they do not map cleanly onto milliseconds.
Then it goes off the rails. A year, the comment claims, can contain 365 or 364 days, and a decade can have between 1 and 3 leap years depending on when you map it onto the calendar. A 364-day year would imply a negative leap day — a concept considerably more alarming than the already-dreaded negative leap second.
In practice it is nothing more than a fat-fingered typo for 366, and it has zero effect on the class's behavior. That is presumably why it has sat there undisturbed since the initial commit twelve years ago. The TimeSpan class itself has barely been touched in that time, being essentially a wrapper around a millisecond count, while more complex date arithmetic such as AddMonths and AddYears lives in the date-time types built on top of it.
The file rewards further browsing anyway: it contains deprecated default constructors and compile-time hooks supporting legacy .NET variants including Silverlight — a technology last updated in 2019, unsupported in major browsers since 2015, and officially end-of-lifed in 2021. Not a true WTF, perhaps, but a pleasant reminder that even Microsoft's reference source has its cobwebs.
Comments
No comments yet — be the first.
Open the discussion
No account or password needed — just enter your e-mail and we’ll send you a one-time sign-in link. First time here? You’re set up automatically.
Your rating will be applied automatically after you sign in.
Check your inbox
We’ve sent a sign-in link to …. Open it on this device — this tab will sign you in automatically.
Waiting for your click …
·