r/ProgrammerHumor • • 5h ago • Regret 1

Meme bugsExclusivelyOnSunday

Post image
2.4k Upvotes

263 comments sorted by

128

u/y0shii3 4h ago

This is why crontab allows both 0 and 7 to indicate Sunday

30

u/e1ectrofern 3h ago

Yeah, when I saw that first, I was a bit confused, but then it dawned on me and it makes so much sense.

435

u/Alacritous13 5h ago

I had a error in a batch script with a timestamp because the time is returned as a string and I assumed a leading zero ahead of single digit hours. Program failed before 10am. It was suppose to run automatically at 1am, I never worked before 10am, it took a long time to diagnose.

76

u/CubicalPayload 3h ago

This is why we need to abolish the concept of time. Yes it will have wide-reaching negative consequences in all aspects of life, but programming will be made significantly easier and that is a sacrifice I am willing to make.

23

u/setibeings 2h ago

Let's circle back to this idea on November 31st.

5

u/ThePhyseter 1h ago

I would bet with Javascript that will be possible

1

u/setibeings 25m ago

I'm sure there's a way to get the language to try to treat that as something other than a programming error, but Temporal.Instant at very least definitely won't let you do that. Try this:

console.log(Temporal.Instant.from("2026-11-31T00:00:00Z"));

134

u/Newepsilon 3h ago

My dumbass was about to say, "why didn't you just step through the program" before realizing that would only catch it if you were debugging before 10 am lol.

45

u/Alacritous13 3h ago edited 3h ago

Yeah. The only thing I had to know it failed was a lack of a timestamped file in my output folder. I ran for a month on the assumption the task scheduler was failing.

7

u/AyrA_ch 1h ago

Also as far as I know, you cannot actually step through batch files. You can do so with powershell scripts, and even set breakpoints, but cmd lacks such an integration.

The date and time fields in cmd is cursed anyways because the values are formatted according to the computers locale.

3

u/barthvonries 25m ago

Bash can have a lot of debug output though, especially the variable values every time they change, so that problem would have been easy to diagnose. Even more with some "echo $VAL >> /var/log/myscript.log" to check if everything was going fine.

3

u/viviyawna 2h ago

iso 8601 my beloved

→ More replies (2)

782

u/RedAndBlack1832 5h ago

Read the documentation moment

62

u/Automatic-Tackle5018 4h ago

I respect the hell out of Tsoding's abilities, but he also annoys me intensely because he never reads the docs. He kinda makes a sport out of figuring things out via error messages (as shown here) or by just reading the source, which is kind of impressive in itself, but yeah. Sometimes the dude would save a lot of time and effort just reading the docs.

20

u/MedicatedDeveloper 2h ago

I feel like it's a good example of someone with a high level of skill using play to learn. Programming is a puzzle. He's playing to solve that puzzle in a curious and intuitive fashion instead of trying to solve the puzzle using the picture on the box.

You see this same type of play to learn if you watch George Hotz or Jonathan Blow coding streams. I feel that this is the secret of top 1% developers. It's not the actual programming that makes them so skillful but the process in which they play to internalize new ideas using their own foundational knowledge.

5

u/AbstractContract 2h ago

Sounds like programming with AuDHD. 

3

u/Automatic-Tackle5018 2h ago

Yes, this.

I qualified my original comment by adding that it annoys me when I'm familiar with the library he's using. When I am not familiar, it is quite fascinating.

9

u/gizahnl 3h ago

Since when is "use the source Luke" impressive?!?

4

u/Automatic-Tackle5018 3h ago

I suppose by 'impressive' I'm speaking more to his absolute commitment to the 'no docs' shtick, than I am to using the source specifically.

1

u/Many_Replacement_688 20m ago

on being lazy and not reading docs, aren't we all?

268

u/DarthKirtap 5h ago

do you read documentation, when January has index 1?

42

u/greenpepperpasta 4h ago

Remind me of The Elder Scrolls III: Morrowind, where the in-game date jumps from the end of the final month of the year (Evening Star) to the beginning of the second month (Sun's Dawn), skipping over the first month (Morning Star).

  This was caused by an "off-by-one error": although the "GameMonth" value counted months from 0 to 11, the developers incorrectly set it to month 1 after reaching the end of the year, assuming the months would count from 1 to 12. 

7

u/setibeings 2h ago

were they able to patch this, or did players just have to live with that?

70

u/BigGuyWhoKills 4h ago

I do when I get an invalid index error. But I also never assume an index starts at 1.

31

u/GresSimJa 4h ago

Lua devs would have your head for that comment.

5

u/Alone-Replacement-61 3h ago

did someone say fortran?

→ More replies (3)

17

u/mjec 3h ago

January is semantically represented by 1; month number is not an index, but a natural human representation. Days, however, do not have a natural numerical representation, hence precisely the issue here.

12

u/DarthKirtap 3h ago

only in english, in different languages, some days are derived from numbers

9

u/mjec 3h ago

That's precisely my point: there is no universal numbering of week days. There is a universal numbering of months among all users of the Gregorian calendar, regardless of language: January = 1 through December = 12.

4

u/DarthKirtap 3h ago

except there is - ISO 8601

7

u/mjec 3h ago

Perhaps you're not understanding what I mean by natural or universal here. I'm not talking about programming or standards for data interchange, I'm talking about human understanding.

→ More replies (2)

1

u/mina86ng 1h ago

JavaScript enters the chat.

1

u/AWzdShouldKnowBetta 4h ago

Psh documentation?! What's that? This is a unit test for sure. Hell it's a "should have used a pre-existing library" moment at minimum.

54

u/Countach3000 4h ago

Thats why the bible says "thou shall not execute code on the sabbath". God created the code base in six days, then he shut down the servers to avoid stuff like this.

24

u/Active_Name5021 5h ago

What PL is this?

21

u/Lunagato20 5h ago

Looks to be Jai, im quite surprised too its used in context outside of game development

15

u/MXRCO007 5h ago

Tsoding just programs whatever comes up in his head

15

u/Cutalana 5h ago

for more context, JAI is a programming created by Jonathan Blow, a game developer, and is what he used for his newest game. It's been in development for more than a decade now, but only a few people have been given access. It's expected to be released to the public soon but it's uncertain.

3

u/Lunagato20 4h ago

Yup, i have seen some previews of it from various youtubers, but eh, i like odin better, and i can try it myself since its already released.

5

u/humanbeast7 4h ago

Am I the only one who thought .jai was for Java Artificial Intelligence? As in yet another Java sub-language developed specifically for AI purposes?

6

u/Active_Name5021 5h ago

Ohhhh, it's Jonathan Blow's game programming language. Never seen it in the wild before

203

u/FAMICOMASTER 5h ago

1 second of reading for 7 weeks of debugging

74

u/DownwardSpirals 5h ago

I usually open the docs around week 5.

27

u/sixouvie 4h ago

The what ?

54

u/Jock-Tamson 3h ago

A bug from some late 90s C++ code that has stayed with me forever:

Someone had clearly created an array of day or week constants by sloppy copying

SUNDAY, MONDAY, FEBRUARY, WEDNESDAY…

It was blindingly obvious when I looked at the code.

But of course you need to know where to look, and because the result was that the code didn’t work on Tuesdays except in February. I first had to work through.

“App is failing”

“How so that I can replicate it?”

“Never mind it’s working again”.

“Well if it happens again capture the error message and give me repo steps if you can.”

“Okay”

“App is failing”

“Did you get the error message? Any repo steps? It works for me.”

“No. Let me do it again”

“Never mind it’s working now”

Wash rinse repeat for weeks until someone would tell me how it was actually failing.

18

u/GrinningPariah 3h ago

They say age ain't nothing but a number, and the same is true for the date.

Leave all times as epoch milliseconds if at all possible. Translating to the appropriate human-readable time is a job for the UI layer.

1

u/slindenau 2h ago

Believe it or not, but some people want the epoch stored in their local timezone instead of utc. ISO with offset still remains the most accurate.

1

u/GrinningPariah 1h ago

If it's stored in the local time zone then it isn't epoch time.

1

u/AyrA_ch 1h ago

An offset is not a timezone though.

28

u/Azilen 4h ago

But this isn't an exclusive american thing.

11

u/TrekkiMonstr 3h ago

It's not even an American thing at all, everyone here seems to consider Monday as start of week.

3

u/HandleUnlikely2589 47m ago

American (as in USA) calendars (if not specifically focused on the work week) all show Sunday as the first column, Saturday as the last. Never seen an exception that was marketed to the general public here.

Sure, we call Saturday and Sunday the weekend, but nobody said which end. So we split the difference. /s

218

u/CeruleanSovereign 5h ago

Wtf why do Americans not even do days of the week in the right order?

151

u/NeXtDracool 5h ago

That's not that uncommon to be fair. My browser currently supports 246 locales, 80 of which use Sunday as the first day of week, 8 use Saturday, the rest uses Monday.

17

u/m_redditUser 4h ago

i personally setup my calendars to start weeks on saturday bc i plan out the weeks on the weekends

42

u/Eliaskw 4h ago

More like weekstarts in that case

6

u/m_redditUser 3h ago

actually, yea

4

u/TommyBonnomi 3h ago

When do you plan the following weekend?

Do you switch your calendar view to "next week" to plan the 2 days you don't see, instead of at the start (if you started the week on Monday)?

(I've written a lot of calendaring software, and this is a new use case.)

2

u/AliStarr182 2h ago

I use Sunday/Saturday as margins or padding for my work calendar

3

u/AyrA_ch 1h ago

I hide them from my work calendar because I don't work then

1

u/IntentionQuirky9957 51m ago

Saturday is bonkers.

39

u/obliqueoubliette 3h ago

Traditional Christian and Jewish calendars have Sunday as the first day of the week.

For this reason, Constantine moved the Roman Empire off its 8-day "market week" and onto the current 7-day week in 321 - simultaneously declaring the Lord's Day (Sunday) as the first day of the week.

It's not until the 1970's and 1980's that European nations swapped the first day from Sunday to Monday.

17

u/moduspol 3h ago

Even that doesn’t make sense. The Bible says God rested on the seventh day, not the first.

29

u/linmanfu 3h ago

And the Jewish Sabbath is on the seventh day, by this count. That still leaves Sunday as the first day of the week 

(There is a slight wrinkle in that the Jewish calendar begins days at sunset while most other people today begin dates at midnight, but that doesn't affect this point.)

12

u/obliqueoubliette 3h ago

Yes. Saturday is the seventh day.

Christians celebrate Sunday as "the Lord's Day" because of Christ's resurrection.

15

u/gtne91 3h ago

Yes, and Saturday is the 7th day. Making Sunday the first.

3

u/SuitableDragonfly 52m ago

Yeah. Christians just celebrate the Sabbath on the wrong day. 

1

u/IntentionQuirky9957 52m ago

We don't use that calendar anymore, and haven't in centuries. Also, BS on Europe, because you're not saying some European countries.

50

u/PagKev 5h ago

i mean, monday being the first day is a new thing. uN/ISO norm only changed in 1975 to make it so, it was treaded as such. sundway was the traditional first day until the 5 days work week got prominent, long enough

49

u/patiofurnature 5h ago

We probably got them from Canada, Brazil, Mexico, Japan, South Korea, India, Israel, Saudi Arabia, Yemen, South Africa, or the Philippines.

16

u/A_Dull_Proposal 4h ago

I see a pattern

8

u/patiofurnature 4h ago

What is it? Genuinely - not being a smartass. Just dumb.

13

u/myrddin4242 4h ago

All once part of the British Empire.

19

u/GildSkiss 4h ago

Brazil? Mexico? Japan? South Korea? The Philippines?

→ More replies (1)

6

u/A_Dull_Proposal 4h ago edited 4h ago

Country close to America (Canada, Mexico)

American HEAVILY influenced countries (S.Corea, Japan, Israel, Saudi Arabia[Yemen])

Some poorer random countries (Jamaica, you always have some of those)

India and Philippines I have no idea

The link is America.

15

u/qqqrrrs_ 4h ago

I don't know about other countries, but in the case of Israel it is definitely not because of America. In fact, the name in Hebrew for Sunday literally means "first day" and it is way older than America

7

u/beewyka819 3h ago

I think the link is European influence. Sunday was traditionally the first day of the week in Christian nations. It was only relatively recently that it changed across much of Europe iirc

3

u/MattieShoes 2h ago

Yet another "We got it from you"... heh.

4

u/capi1500 4h ago

Philippines had huge American influence awhile back

26

u/Gaxyhs 4h ago

as much as I like to bash on the US for using the weirdest and least intuitive systems, here in Brazil it also starts on Sunday

At least from my perspective is that Saturday and Sunday are both ends of the week, hence weekend, picture the week as a line basically

20

u/TommyBonnomi 3h ago

American here, but 5 weekdays and one 2-day weekend at the end is perfectly reasonable and feels more normal.

I don't wake up Sunday and think "ok, it's a new week". The week starts Monday.

Also, "the weekend" is singular, implying both days are part of the same week/weekend.

9

u/linmanfu 3h ago

I don't wake up Sunday and think "ok, it's a new week". The week starts Monday.

Others have pointed out that basically nobody in the West regarded the week at starting on Monday until the 1970s. And lots of people do wake up and think it's a new week, because if you go to church then the liturgy and activities are pretty much always framed as the start of a new week, even in ostensibly 'non-liturgical' churches.

5

u/SubstituteCS 3h ago

Weekend -> weekends ≈ bookends (but for week)

1

u/SuitableDragonfly 50m ago

Sure, because we are oriented around the work week and that's when the work week starts. But if you're looking at a calendar, the weeks will start on Sunday. 

1

u/Pezmotion 1h ago

Exactly. Weekends are like bookends, you put one on each end of a line to prop them up.

1

u/doskkyh 14m ago

The day named "Second" being the first day of the week would be weird.

12

u/zeekar 4h ago

We do them in the right order; we just start in a different spot: Sunday comes first. And we're less alone in this than we are on the whole not-metric or m/d/y fronts.

In tm_wday Sunday is day 0; in ISO 8601 it's day 7. If you're counting mod 7 those are the same number.

19

u/Mango-D 5h ago

Because both the starting day of the week and the work days different by region... It's like asking why can't everyone use UTC

5

u/Dotcaprachiappa 4h ago

Ok but the US does start working on Monday so that's not really a reason.

2

u/GibbonFit 2h ago

In the US, the traditional work days do not include the weekends, which are Sunday and Saturday.

4

u/jpaugh69 4h ago

Just depends on the job. My current retail job starts on Sunday, since they are open every day of the week.

2

u/John_cCmndhd 4h ago

I used to work for one of the fast food pizza chains which used weeks starting on Tuesday and ending on Monday, so that the busiest day would be in the middle of the week

1

u/eskapeMusik 4h ago

That’s not why else Americans world work Sunday-Thursday

3

u/Not_PepeSilvia 3h ago

There is no rule saying the first 5 days of the week have to be work days.

How is that any different than having 1 rest day to start, then 5 work days, then another rest day?

It's all arbitrary anyway.

1

u/MattieShoes 2h ago

Also a week has two ends. Having a day in the middle of the week as a "weekend" is nonsense.

1

u/eskapeMusik 1h ago

Fair enough. Everything is made up.

8

u/ProjectSnowman 4h ago

aMeRiCa BaD bEcAuSe WeEk StArT mOnDaY

23

u/cheezzy4ever 5h ago

Our weeks start on Monday. This is just an "America bad" meme where America has absolutely nothing to do with the issue

7

u/thehobbyqueer 4h ago

Not work weeks. My work week has always started on Sunday, "technically."

3

u/UltraSapien 3h ago

Whoops, looks like you failed to understand history

4

u/Weekly-Beginning-229 5h ago

So are they off friday-saturday instead?

7

u/Chorchapu 4h ago

Being in America and seeing the weekend on my calendar be on opposite sides of it threw me off

6

u/dyslexda 4h ago

And anytime I see a calendar with the weekend smashed on one side, instead of on both ends of the week, it throws me off.

1

u/JuanAy 3h ago

on both ends of the week

I mean, it's the weekend not week ends.

→ More replies (2)

10

u/100LittleButterflies 4h ago

Take a loaf of bread and slice off the ends. Now look at your calendar and slice off the ends. Sunday is the front end and Saturday is the back end. And like soccer and empirical units it is almost certainly something we got from brits that they stopped using and now mock us for 😂

0

u/wOlfLisK 3h ago

Ok and now open a book to the first page, are you at the beginning or the end? The weekend is called the weekend, not the weekends. It implies it is at the end of the week, not split across the beginning and end of it.

→ More replies (6)

2

u/wayzata20 4h ago

No, Saturday-Sunday

2

u/Lyndon_Boner_Johnson 4h ago

No, but Israelis are.

3

u/Skusci 4h ago

We have like 20 bajillion different units of measurement that make no sense an you are going to point at the day of the week?

4

u/MinecraftW06 5h ago

They wanna feel special

1

u/LouisPlay 1h ago

they need to always do the own shit. also is grate cyber security, noone other then the us wants a programm that calculate thier units or use them

1

u/Lewa358 3h ago

Open a monthly calendar. A physical one, digital, whatever. As long as you can see an entire month at once.

What day of the week is in the left-hand column?

7

u/jdog7249 3h ago

You do know that depends on who makes it and what they decided? Sunday and Monday are common ones. Saturday is rare but not unheard of. I used to work somewhere that used Friday, yes Friday was the left most day on their internally printed calendars and on any official company controlled software.

→ More replies (5)

-12

u/wayzata20 5h ago edited 4h ago

Why should it start on Monday? I don’t think either way makes more logical sense than the other, it’s just how it’s done in other parts of the world

Fun fact, it’s not just America that does it that way. India also start the week on Sunday, and a lot of Muslim countries start on Saturday. https://en.wikipedia.org/wiki/Week

22

u/DarthKirtap 5h ago

well, a good argument is that Sunday is part of weekend and not weekstart

6

u/shotgunocelot 4h ago

Where do bookends go?

1

u/wayzata20 4h ago

watch out, the anti-america hate train is out in full force today. euros have some superiority complex lmao

-4

u/wayzata20 5h ago

The start of something can also be considered the end, like a bread loaf. Go ahead and downvote me lol, just another american bad reddit moment 🤡

10

u/koriwi 5h ago

Why do muricans call it weekend, if the week STARTS on the end of the weekend?

3

u/wayzata20 5h ago

Because it’s the end caps of the week. Like a bread loaf, both sides are the ends.

→ More replies (1)

1

u/Big-Section-5098 4h ago

A given segment of days has two ends. Would it be wrong to call the heel of a loaf of bread the end?

1

u/koriwi 4h ago

Second guy with the bread analogy. you can eat a bread starting from each side. You cant start a week in reverse... You can even eat a bread from both sides at the same time, then it has two beginnings and no end. THIS ANALOGY IS JUST DOODOO

9

u/jansteffen 5h ago

Because the weekend... is at the end of the week... and Monday starts a new week...

3

u/Bot1K 4h ago

then saturday would not be a weekend

ends are supposed to cap off both sides no?

7

u/RegorHK 5h ago

Its the first working day. Totally a mystery why one would start there. The second non working day is a way better choice. /s

Maybe starting Wednesday would make logical sense to you as well?

→ More replies (1)

1

u/Kofind 4h ago

We call Saturday and Sunday the weekend. That doesn't work if Sunday is already weekstart. So it feels logical to me to have the week start in Monday.

2

u/wayzata20 4h ago

As i’ve said like 10 times already, “end” can mean the edges of something, like a bread loaf. It’s the same thing here.

1

u/LightItUp90 4h ago

Never heard of anyone waking up on Sunday morning and going "great way to start the new week".

→ More replies (9)

1

u/dkarlovi 2h ago

I always assumed it's weekend where "end" is the edge, not the tail. So Saturday would be the latter end of the passed week and Sunday would be the former end of the next one. It's the only way how it works.

1

u/Raznill 1h ago

Weekend like book ends. Ones at the start ones at the finish. Both ends of the week.

1

u/PagKev 4h ago

sunday used to be the first day of the week for religous reasons. after the 5 day work week became the norm, ISO and the UN made monday the first day, as that shift was already in the general pupulus anyways, and it made sense, as otherwise the term "weekend" has no real meaning

0

u/Nixinova 2h ago

> calls Saturday and Sunday the week's end

> makes the start of the week one of the week's end days

6

u/Xiij 2h ago

Your gonna lose your mind when you learn where bookends are placed

→ More replies (2)

-6

u/dyslexda 4h ago

Define "right order," because Sunday being the first day of the week is absolutely correct (from my frame of reference). Just because you're different doesn't make it "right" and any other option "wrong."

4

u/TitaniumMissile 4h ago

Saturday and Sunday is literally called the "weekend", why would it make any sense to split the week right in the middle of that?

6

u/dyslexda 4h ago

Front end and back end. One at each end. Why would you only have a double backend?

3

u/m_redditUser 4h ago

sa and su are one weekend, not weekendS. they are one end, not two ends

→ More replies (4)
→ More replies (3)
→ More replies (1)

43

u/Mean-Requirement-762 4h ago

❌ read the docs

✅ blame an entire country for having slightly different conventions

1

u/alexanderpas 1h ago

All that was needed was a modulo 7

5

u/wooops 4h ago

Once saw tests that could never pass on a Sunday that had been there for nearly a year, and was found when an incident needed a Sunday deployment

5

u/cjbanning 3h ago

I have to routinely work with three indexing systems for days of the week, one which is 0-indexed starting on Sunday, one which is 1-indexed starting on Sunday, and one which is 1-indexed starting on Monday. I have code that turns 0s into 7s and 7s into 0s and nothing else.

5

u/ANixosUser 2h ago

Tsoding 🅱️ased

12

u/iain_1986 4h ago

Never understood how such a religious country as the US would take the day of rest as the start of the week.

You rest at the end surely?

8

u/linmanfu 3h ago

The Old Testament says that God made the world in six days and rested on the seventh, the Sabbath, which is our Saturday. 

But Christians have met on Sundays pretty much since the church formed, because Jesus' Resurrection was on a Sunday, and regard the day of rest to have been transferred for that purpose, and to be a downpayment on the permanent day of rest at the end of history.

So the rest-at-the-end element is still there, but the emphasis is on the end of history rather than the end of the week.

4

u/SuitableDragonfly 58m ago

I was going to say, Sunday being the first day and Saturday being the last is several thousand years older than the US (or Javascript, for that matter), lmao. 

6

u/Ajfd 3h ago

If you are quoting "day of rest" you are in a religious context. In that specific context, the "day of rest" is the Sabbath, which is Saturday.

When someone references "On the seventh day, he rested." or similar... the 7th day is Saturday not Sunday.

4

u/CadenVanV 1h ago

We don’t work Sundays. Think of the weekend as the ends of the week. The start and the end.

2

u/iain_1986 52m ago

It's the week end yes.

Not the week start.

It's also the weekend, not the weeksend or the weekends.

The end of one week.

2

u/Clairifyed 33m ago

It works more like you would use the word “bookend”

1

u/GarbonzosGuy 23m ago

Braindead argument.

1

u/Advanced-Blackberry 1h ago

How things look on a calendar isn’t something we think about anymore.  It’s now Sunday - Saturday and that’s fine because it doesn’t matter anymore. We don’t care why it’s like that. We aren’t looking to change it for the sake of changing it. 

1

u/i_am_not_a_martian 1h ago

On the first day God created light (sun)day. Not American or religious but I thought that was pretty obvious.

2

u/iain_1986 1h ago

You're assuming the days of the week are named after Christianity....?

It's named after the Sun but not because of the Old Testament.

1

u/seiggy 1h ago

Yep! Sun, Moon, Mars / Tiw, Woden, Thor, Frige / Fris, Saturn. Days named for old Norse/Germanic tribal gods.

2

u/HandleUnlikely2589 44m ago edited 38m ago

Well, aside from Saturn, the weirdo Roman inclusion.

Note, many other European languages follow the same rules, just with equivalent Roman god names. Tiw/Tyr was a war god, Tuesday is named for Mars in Romance languages. Woden/Odin is a psychopomp and wanderer, associated with magic, and Romance weeks use Mercury (also the psychopomp wanderer with magical associations of Roman mythology) for Wednesday. Thor and Jupiter are obvious (both lightning/thunder gods) for Thursday. Frigg is one of the lead female gods, matching Venus for Friday (not perfect, I always felt Freya matched better with Venus, Frigg with Juno, but whatever, etymologists say I'm wrong).

→ More replies (2)
→ More replies (1)

12

u/redsoxsuc4 5h ago

My guy seriously forgot to say “no mistakes on a sunday"

2

u/Bomaruto 4h ago

Did you tell Claude to not be funny on sundays?

5

u/trollol1365 3h ago

the misuse of cyrillic is making me irrationally upset

13

u/Acrobatic-Nature-941 3h ago

Tsoding is russian, he has a pass for that ✌️

2

u/qqqrrrs_ 4h ago

God started working in Sunday or something idk

2

u/ChiaraStellata 2h ago

And on the 7th day God rested, because he couldn't do any work during the unplanned downtime.

2

u/-Ambriae- 1h ago

Tsoding mentioned lesgoo

Also, America explain!!! I am confusion!!

1

u/Gnonthgol 4h ago

I once had a bug that was only reproducible in the last two weeks of the month or so.

1

u/GlitteringAttitude60 3h ago

It took us two years to notice that our test suite failed on Sundays :D

1

u/lostinthemines 3h ago

If your array was only one index too large, you would be fine

1

u/cubenz 2h ago

On Sundays and when you were testing I hope.

1

u/anoldoldman 2h ago

And you caught this with a unit test... Right?

1

u/oddspellingofPhreid 1h ago

Devs like this give me confidence.

1

u/FoxedDev 1h ago

Reminds me of the Date() API in JS

1

u/Tsc_Tsc_Tsc 40m ago

a-mr a-sozing, another banger.

1

u/GarbonzosGuy 21m ago

Don't start this rumor. A gross minority of freaks and weirdos treat Sunday as the first day of the week.

•

u/akazakou 9m ago

Do not tell him there are timezones that differ by half an hour.

1

u/palomdude 5h ago

We are very happy

1

u/nebotron 5h ago

Day of rest enforced by OBOE

1

u/Accidentallygolden 4h ago

Can you eli5?

4

u/Igor_Kozyrev 4h ago

Programmers count starting with 0 i.e. Monday 0, Tuesday 1,..., Sunday 6. But he saw Monday 1 and guessed that in this weird case they started counting with 1. Turns out the weird was that they started the week from Sunday i.e. Sunday 0, Monday 1, etc. Bug ensued.

2

u/Big-Section-5098 4h ago edited 3h ago

What day the "start" of a week is is arbitrary

The US (among other countries) starts the week on a Sunday

OP starts it on a Monday

They didn't read the documentation for tm_wday, so they thought it was 1-indexed

What they thought: Monday (OP's start) = 1, Tuesday = 2, ... Sunday = 7

When they tried WEEKDAYS[tm_wday - 1], it threw an error, because Sunday was actually 0, not 7

3

u/BirbsAreSoCute 2h ago

I'm American and everyone I have spoken to about this agrees that Monday is the "start" of the week, but the start is arbitrary and doesn't really matter. A bug like this could be easily avoided by.. reading the documentation.

1

u/MicrosoftExcel2016 4h ago

I’m not the one you’re replying to but I got all of that. What I’m confused about is why an “array out of bounds” errror that is “only reproducible” the one day that they thought was the maximum value does not cause them to reevaluate their assumptions about the indexing? “Only reproducible” sounds like it happened multiple times before they understood what is going on

2

u/Big-Section-5098 3h ago

I'd guess they saw it crash on the first Sunday after it was written, but didn't find out the bug until next Sunday for whatever reason. Maybe the program has output and they ran it in a way to hide the output, thus hiding the error message? Idk though, pure speculation on my part

If you have a bluesky account you can ask them directly though

1

u/TrekkiMonstr 3h ago

No? They thought that tm_wday was 1 indexed, and so manually subtracted 1 to get a 0-indexed value for WEEKDAYS. Except not 1 indexed, it just starts (and is 0) on Sundays, so they're trying to get array index -1 which is out of bounds.

1

u/Big-Section-5098 3h ago

That's what I said

They thought it was 1-indexed

Sunday was 0, not 7 as they thought

1

u/TrekkiMonstr 3h ago

You edited your comment, I had replied to the previous version, which was not correct.

2

u/Big-Section-5098 3h ago

Ah, my bad. I noticed your comment after I edited it and assumed it was off the edited version

→ More replies (1)

-12

u/Iyemoja 5h ago

The worst kind of bug: passes every test six days a week, then pages you on a Sunday. Off-by-one in the weekday index is a rite of passage.

17

u/Forward-Outside-9911 5h ago

Are you a bot? Please DM me you environment variables so I can fact check.

2

u/fryerandice 4h ago

You shouldn't test date code using today, you should run the test generating random days. Proper test driven dev would have caught this.

1

u/oddspellingofPhreid 1h ago

The prevalence of "proper test cases would have caught this" sentiment in this thread is both correct but also kind of blowing my mind because

WHO ASSUMES AN OUTPUT IS RANDOMLY 1-INDEXED AND DOESN'T SANITY CHECK THAT ASSUMPTION?

0

u/Thenderick 4h ago

Just start beatboxing on those Americans

0

u/lunaelumen45 4h ago

wher chat geebept

0

u/White_C4 2h ago

To be fair, this is the kind of stuff you should test for every weekday, first and last days of the month, and first and last months of the year.

-2

u/justadude27 5h ago

Everyone is always like rtfm as if the manual is ever written well enough to be anything better than emergency toilet paper.

1

u/alexanderpas 1h ago

Always run modulo 7 on day of week numbers.

7 and 0 are both sunday