Tory and Reform mayors plan to hand tax rebates to local residents under Andy Burnham's devolution drive
PETER HITCHENS: I don't have 'Trump Derangement Syndrome' - it is time the world finally stood up to this dangerous man
Is Gianni Infantino 'untouchable', how could the FIFA president be stopped and who could replace him? All the big questions answered amid fury over plans to sell stakes in the World Cup
Mayhem for commuters as rail services in and out of Essex CANCELLED
Mayhem for commuters as rail services in and out of Essex CANCELLED
Sixty years on from THAT World Cup final... what happened to England's 1966 heroes?
'I'm going on a crazy mission': How a baby-faced teenager was paid £21,000 to travel from Norway to Huddersfield on a mission to kill on behalf of Iranian terrorists
'Huge' number of fires rip through Essex countryside in night of chaos
Dramatic moment Oscar-winning Disney animator, 72, is AIRLIFTED off mountain in helicopter rescue after suddenly falling ill on hike
Should more members of the Royal Family attend the Commonwealth Games in Glasgow? Have your say in the Palace Confidential poll
Ben Affleck lands rare $1million prize during guest appearance on Who Wants To Be A Millionaire
Headteacher had the most guessable username-password combo you could imagine
Qantas Plane Flies For More Than 24 Hours In Record-Breaking Flight
Read more of this story at Slashdot.
'What, a new one? They keep changing every 5 minutes': Care home resident speaks for Britain after meeting Burnham and being surprised to learn he is yet another new Prime Minister
Prince Harry and co may have to foot legal bill of millions over doomed phone hacking claims against the Mail
Gemma Collins announces death of her mum in emotional tribute
Gemma Collins announces death of her mum in emotional tribute
Florence Pugh looks sensational in a silver tassel gown with statement neckline as she poses at the star-studded Spider-Man premiere
CodeSOD: Negative Days
Killian Brendel was looking through the .NET source code, and found this comment on the TimeSpan struct.
// TimeSpan represents a duration of time. A TimeSpan can be negative // or positive. // // TimeSpan is internally represented as a number of milliseconds. While // this maps well into units of time such as hours and days, any // periods longer than that aren't representable in a nice fashion. // For instance, a month can be between 28 and 31 days, while a year // can contain 365 or 364 days. A decade can have between 1 and 3 leapyears, // depending on when you map the TimeSpan into the calendar. This is why // we do not provide Years() or Months().Okay, a TimeSpan represents a duration of time. Makes sense. It can be negative or positive. Sure. It's a number of milliseconds. Okay, yeah. Other units of time get hard to represent that way, because months could have 28-31 days. Sure, yeah. I'm with you. And a year could contain 365 or 364 days, and a decade could have between 1 and 3 leapyears.
Wait, go back one. How long can a year be? I know negative leap seconds are going to be an issue, but negative leap days are gonna be way worse.
In the scheme of things, this isn't much more than a fat-finger typo. It doesn't impact the behavior of the class, which is why it's been sitting there since the initial commit, twelve years ago. The TimeSpan class itself hasn't been touched in that time, which also isn't much of a surprise, since it's really just a wrapper around a number of milliseconds. More complex date arithmetic, like AddMonths or AddYears is handled in the various date-time related objects.
So, is this a true WTF? Well, probably not. But it's interesting. Actually, the whole class is kind of interesting, as you can spot deprecated default constructors, as well as compile-time hooks for handling support for older versions of .NET including Silverlight, a technology that hasn't received an update since 2019, hasn't been supported in major browsers since 2015, and officially left support in 2021.
.comment { border: none; }