News for hackers. Stuff that matters.
Re:Ask HN: How is it that programmers can simply ignore leap... by bartvk on Friday January 14, 2022 @06:19PM (#29941855)
> If I create a date object of 1970-01-01T00:00:00 and repeatedly add 86400 seconds, should I not end up with a date/time that is no longer midnight?

Of course and that’s why you shouldn’t do that. I don’t know about other languages, but if you want to advance a certain number of days, you don’t just add seconds. Any code review would pick that apart.

You add (or subtract) date components, meaning you specify a day, week or whatever unit.

Do I misunderstand the question?

Re:Ask HN: How is it that programmers can simply ignore leap... by sporkle-feet on Friday January 14, 2022 @07:13PM (#29942247)
If we were taking leap seconds into account, we should end up with a date/time that is not midnight.

Because it does always remain midnight, it shows we are all ignoring leap seconds.

Re:Ask HN: How is it that programmers can simply ignore leap... by sla29970 on Saturday January 15, 2022 @01:33AM (#29944142)
"ignoring leap seconds" is equivalent to "using a time scale that does not conform to UTC". Time scales other than UTC have 86400 seconds in a day. UTC is the exception.
Re:Ask HN: How is it that programmers can simply ignore leap... by dismantlethesun on Friday January 14, 2022 @11:14PM (#29943466)
> I don’t know about other languages...

Other programming languages apart from what? You never specified which language you're talking about.

Re:Ask HN: How is it that programmers can simply ignore leap... by bartvk on Saturday January 15, 2022 @01:55AM (#29944282)
Oof I somehow butchered that. Swift.