3 ms·
>Leap years occur every 4 years. Isn't leap year calculation one of the very first things you do in most programming tutorials/schools? I know that a lot of pe
by dailykoder 4y ago
>Leap years occur every 4 years.
Isn't leap year calculation one of the very first things you do in most programming tutorials/schools? I know that a lot of people don't know this, but most programmers should, r-r-r-right?
- atoav 4y agoIf you handle dates and times yourself on that level, prepare to be in a world of pain. Handling time and dates correctly has a similar difficulty to writing your own cryptographic primitives: If you don't know exactly what you are doing you will shoot yourself (and potentially countless others) into the foot at one in point or another.
- rocqua 4y agoSee also the problems in the Excel datetime calculations that are now unfixable because a fix would break many existing problems. e.g. https://en.wikipedia.org/wiki/Leap_year_problem https://en.wikipedia.org/wiki/Leap_year_problem
- wruza 4y agoTbh, half of my life I handled them on a financial platform which couldn’t care less of the subj list or standards. It has just ‘wall date’ like yyyy-mm-dd and ‘wall time’ strictly in 00:00:00-23:59:59 range, without a timezone. Two separate types. Never encountered of even heard of any time-related bug there. I find this simplified date/time very useful, unless you have to manage “continuous and/or real” time somehow. 99% of applications are okay with it, because they’re facing users with exactly the same mental model. Also, albeit not correct scientifically, it reflects many developers’ mental model as well. This is much better than a model that just doesn’t match, which is a world of pain. Someone adds 86400 but it’s the same day, good luck debugging it. I don’t think this is a cryptographic-level issue.
- bee_rider 4y agoMy uninformed guess would be that a financial platform mostly just wants a monotonically increasing clock with which to order transactions. So this would I guess avoid quite a bit of the annoying date related stuff. (?) Anyway if you queried something to get the current date-time and clock-time, you could be farming out the annoying edge cases to some arbitrarily complicated library, right? Which is the right way to do things.