Live data from Hacker News

Ask HN: Did you encounter any leap year bugs today?

news.ycombinator.com

351–360 of 498 posts

Re: Ask HN: Did you encounter any leap year bugs today?

#351
post #341

Earlier quoted context omitted.

Blows my mind that people consider using ChatGPT for serious applications. I mean it's fine as a code autocorrect/autocomplete tool as in GitHub copilot. But it should not replace the code itself. You encounter a bug in the code, you fix it, you never encounter it again. But ChatGPT will repeat the same mistake sooner or later. That's not how we should engineer solution for critical problems.

If the cost-savings is worth it compared to the problems... I mean, that's how we do it with humans. It's quite a common occurrence to keep a part of a business process human because automating it would we too expense due to edge cases. Humans make mistakes and are expensive, but are also flexible and usually smartish. ChatGPT makes mistakes and is usually dumbish, but is also flexible and cheap. Engineering is about…

> ChatGPT makes mistakes and is usually dumbish, but is also flexible and cheap.

People wouldn't mind it if the keyword `dumbish` has been all along there.

Re: Ask HN: Did you encounter any leap year bugs today?

#352
post #156
post #23

Heard from a friend in China: the age calculation portion of the app to schedule a marriage certificate had a bug where they subtracted 22 (legal minimum age) from the year, which resulted in 2002-02-29 which doesn't exist. The app intends to compare this against the user's birth date. The error handling code assumes all errors are from the comparison. The app then rejected all marriage certificate appointments by co…

How do leap day birthdays get handled in general? How is the right age iterated every year?

Relevant question for driving, voting, marrying, drinking. I'd assume just the date is compared.

If you are born on 29th, on future 28th you are considered "too young", regardless whether a 29th exists or not. On future March 1st you are "old enough" again regardless.

If a 29th exists you are old enough already on that date. Drinking beer in Germany at 16, I guess in some countries at 20 could be relevant cases. For the more common minimum age of 18 for many things, the limit is reached always on March, 1st because a 29th cannot exist.

Re: Ask HN: Did you encounter any leap year bugs today?

#353
Ran into a bug where some code was taking an hour long interval and subtracting 1 year from the start and end times. But the time library handled subtracting a year from Feb 29 as converting it to Feb 28th of the previous year, at the same time. So on-call got alerted because a job failed when an exception was thrown because the start time was after the end time. Fortunately, other than the alert, there wasn't any negative impact. Although, I think if this isn't addressed it may cause issues next year when it includes a bigger interval of time than expected on March 1st.

Re: Ask HN: Did you encounter any leap year bugs today?

#354

I have a friend who was born on Feb 29, and in Quebec your driver's license fees must be paid on or before your birthday or your license is effectively revoked (It's a convenient reminder). He was on his way to pay them on the 29th and got pulled over for having an expired license... after some awkward common confusion with the police they came to the conclusion that the license bureau moves your "reminder" birthday…

Wouldn't the drivers license have the expiration date printed on it?

Re: Ask HN: Did you encounter any leap year bugs today?

#356
post #270

Earlier quoted context omitted.

ChatGPT is specifically bad at these kinds of tasks because of tokenization. If you plug your query into https://platform.openai.com/tokenizer , you can see that"egregious" is a single token, so the LLM doesn't actually see any "e" characters -- to answer your question it would have had to learn a fact about how the word was spelled from it's training data, and I imagine texts explicitly talking about how words are s…

> If you plug your query into https://platform.openai.com/tokenizer , you can see that"egregious" is a single token That says it's 3 tokens.

" egregious" (with a leading space) is the single token. Most lower case word tokens start with a space.

Re: Ask HN: Did you encounter any leap year bugs today?

#357

All street lamps in Paris turned off at midnight :) https://www.leparisien.fr/paris-75/paris-pourquoi-les-rues-d...

The street lights use some sort of timer that's tracking dates? Don't they typically just use light sensors to know when to turn on? It seems to me that'd be a simpler solution and also provide light during solar eclipses, thick storms, etc.

Why should we pick a simple solution like that? Is it the 90s or what? Only a complete clown would pick anything other than a network of zigbee relays controlled by an unmaintained node.js app written by an out-of-business contractor, pulling in sunrise/sunset data from an external API and syncing its local time via a homegrown NTP alternative.

I mean look at electric cars.

Re: Ask HN: Did you encounter any leap year bugs today?

#358
post #323

Earlier quoted context omitted.

Take DOB + n * 365.25 and then pick whatever day that falls in? That way it shouldn’t drift overall. Though, I guess it would imply that what day of the year people celebrate on, would be off by one day on leap years compared to what it is on other years?

This formula doesn't consider how we sometimes skip leap years, and sometimes have leap seconds, so it's vastly imprecise.

So make it more precise. DOB + n * 365.2421.

Re: Ask HN: Did you encounter any leap year bugs today?

#359
post #268

Earlier quoted context omitted.

Is March more logical? Feb 29 + 1 year = Feb 28.

You're begging the question. [1] "Feb 29 + 1 year" is verbatim restatement. --- You can say Feb 29 + 365 days = Feb 28. (And Feb 29 + 730 days = Feb 27.) --- EDIT: Note that in the context of birthdays, people use "calendar years," not "unit of time which is ~1 revolution around the sun." Birthdays aren't celebrated every X million seconds after the moment of birth. They are celebrated the same day each calendar year…

[deleted]

Re: Ask HN: Did you encounter any leap year bugs today?

#360
post #268

Earlier quoted context omitted.

Both Feb 28 and Mar 1 are commonly used to celebrate birthdays. AFAIK there is no firm convention. Feb is more natural ("My birthday is in February"), Mar is more logical (the 60th days of the year).

Is March more logical? Feb 29 + 1 year = Feb 28.

Feb 28 is definitely too early, you haven't lived a whole year yet since your birthday. So March 1 it is. It's not your birthday but you can celebrate having made it another year.
Post reply on HN