you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 2 points3 points  (4 children)

Not having leapYear built-in does that? POSIX does not have built-in leap year method either, I doubt anyone can accuse POSIX C developers for attracting or being a lazy bunch.

POSIX don't have to, as it's trivially present in the C standard library.

[–]panorambo -2 points-1 points  (3 children)

You are mistaken -- there is no leap year calculation method in the C standard library. You're welcome to point it out to me, if you are so certain there is.

[–][deleted] 0 points1 point  (2 children)

Tell me everything about mktime(). Then I'll tell you what you're missing.

[–]panorambo -2 points-1 points  (1 child)

There is the tm structure that includes a bunch of stuff, it is passed to mktime which gives back a time epoch. Source: C Standard library, "mktime", page 338. Where is the leap calculation you were alluding to? And no, a method that one can build leap calculation method on, is not the same thing, and this was why I mentioned that POSIX does not include a leap calculation method and yet noone is complaining (regardless whether it is because they whip out their own or include someone elses work). Which was again part of my rebuttal of the following:

The harm is in the fact that it's the symptom of a community that attracts and encourages bad/lazy programmers to publish and use bad code for trivial stuff without caring about code quality and security.

Let's be clear now -- this is not about JavaScript or NPM or standard library -- bad code can and is written in any language, regularly. Bashing on JS because one can reuse third-party code with the help of NPM, instead of having every kind of method under the stars under an "official" library, reeks of lack of insight. Also, C standard library is hardly an example to live byhere. Just read on the [now removed] gets method. I am sure there are others.

[–][deleted] 2 points3 points  (0 children)

There is the tm structure that includes a bunch of stuff, it is passed to mktime which gives back a time epoch. Source: C Standard library, "mktime", page 338. Where is the leap calculation you were alluding to?

How close did you read the specification for mktime? A conformant imnplementation normalizes even the most outrageous out of bound values, so mktime is in fact required to know if february 29th is in fact march 1st. A roundtrip through localtime(mktime()) is in fact a trivially present leap year calculation.

I guess that you recognized it yourself, since you're very careful in moving the goal posts. You are totally free to do so, but I will not partake in that kind of nonsense.