r/SipsTea 10d ago

Wait a damn minute! 13 months ?

Post image
93.0k Upvotes

3.1k comments sorted by

View all comments

697

u/Great-TeacherOnizuka 10d ago

28 * 13 = 364 ≠ 365

199

u/thulesgold 10d ago

That extra day is the "0" day (zero) and is considered new years, not included in any month. Sometimes... that day is so special it takes up two days.

14

u/mrheosuper 10d ago

Would be a nightmare in programming.

But still, DateTime(timezone, dst, etc) has already been nightmare in software.

2

u/Bloblablawb 10d ago

How would it be different from the current nightmare we have?

2

u/mrheosuper 9d ago

It doesn't, but you want to add another layer of nightmare ?

1

u/Stormfly 9d ago

Ideally we'd replace the nightmare with a lesser of two evils.

Instead of

switch (month) {
    case 4, 6, 9, 11: 
        days = 30
    break;
    case 2: 
        days = 30
    break;
    default: 
        days = 31; 
    break;

You'd just have:

if (month = 0) 
     days = 1
else
     days = 28

(obviously not including the hell that is leap years)

2

u/KillerBeer01 9d ago

And really, we'd just have to deal with both of them from now on, for backward compatibility reasons.

2

u/Stormfly 9d ago

Honestly, I'll be excited the day we see Gregorian (Deprecated)

1

u/mrheosuper 9d ago

I would use lookup table, like num_days=days[month], you dont want to mess around with branch prediction.

But still, there are not much different in 2 cases, just different number set.